thr_private.h (144711) | thr_private.h (144921) |
---|---|
1/* 2 * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * | 1/* 2 * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * |
32 * $FreeBSD: head/lib/libthr/thread/thr_private.h 144711 2005-04-06 13:57:31Z davidxu $ | 32 * $FreeBSD: head/lib/libthr/thread/thr_private.h 144921 2005-04-12 03:00:28Z davidxu $ |
33 */ 34 35#ifndef _THR_PRIVATE_H 36#define _THR_PRIVATE_H 37 38/* 39 * Include files. 40 */ --- 10 unchanged lines hidden (view full) --- 51#include <sched.h> 52#include <unistd.h> 53#include <ucontext.h> 54#include <sys/thr.h> 55#include <pthread.h> 56 57#include "pthread_md.h" 58#include "thr_umtx.h" | 33 */ 34 35#ifndef _THR_PRIVATE_H 36#define _THR_PRIVATE_H 37 38/* 39 * Include files. 40 */ --- 10 unchanged lines hidden (view full) --- 51#include <sched.h> 52#include <unistd.h> 53#include <ucontext.h> 54#include <sys/thr.h> 55#include <pthread.h> 56 57#include "pthread_md.h" 58#include "thr_umtx.h" |
59#include "thread_db.h" |
|
59 60/* 61 * Evaluate the storage class specifier. 62 */ 63#ifdef GLOBAL_PTHREAD_PRIVATE 64#define SCLASS 65#define SCLASS_PRESET(x...) = x 66#else --- 273 unchanged lines hidden (view full) --- 340 u_int32_t magic; 341 char *name; 342 343 /* 344 * Lock for accesses to this thread structure. 345 */ 346 umtx_t lock; 347 | 60 61/* 62 * Evaluate the storage class specifier. 63 */ 64#ifdef GLOBAL_PTHREAD_PRIVATE 65#define SCLASS 66#define SCLASS_PRESET(x...) = x 67#else --- 273 unchanged lines hidden (view full) --- 341 u_int32_t magic; 342 char *name; 343 344 /* 345 * Lock for accesses to this thread structure. 346 */ 347 umtx_t lock; 348 |
348 /* Thread is terminated in kernel, written by kernel. */ 349 long terminated; 350 | |
351 /* Kernel thread id. */ 352 long tid; | 349 /* Kernel thread id. */ 350 long tid; |
351#define TID_TERMINATED 1 |
|
353 354 /* Internal condition variable cycle number. */ 355 umtx_t cycle; 356 357 /* How many low level locks the thread held. */ 358 int locklevel; 359 360 /* Signal blocked counter. */ --- 125 unchanged lines hidden (view full) --- 486 * Current locks bitmap for rtld. */ 487 int rtld_bits; 488 489 /* Thread control block */ 490 struct tcb *tcb; 491 492 /* Cleanup handlers Link List */ 493 struct pthread_cleanup *cleanup; | 352 353 /* Internal condition variable cycle number. */ 354 umtx_t cycle; 355 356 /* How many low level locks the thread held. */ 357 int locklevel; 358 359 /* Signal blocked counter. */ --- 125 unchanged lines hidden (view full) --- 485 * Current locks bitmap for rtld. */ 486 int rtld_bits; 487 488 /* Thread control block */ 489 struct tcb *tcb; 490 491 /* Cleanup handlers Link List */ 492 struct pthread_cleanup *cleanup; |
493 494 /* Enable event reporting */ 495 int report_events; 496 497 /* Event mask */ 498 int event_mask; 499 500 /* Event */ 501 td_event_msg_t event_buf; |
|
494}; 495 496#define THR_UMTX_TRYLOCK(thrd, lck) \ 497 _thr_umtx_trylock((lck), (thrd)->tid) 498 499#define THR_UMTX_LOCK(thrd, lck) \ 500 _thr_umtx_lock((lck), (thrd)->tid) 501 --- 66 unchanged lines hidden (view full) --- 568 _gc_count--; \ 569 } \ 570} while (0) 571 572#define GC_NEEDED() (_gc_count >= 5) 573 574#define THR_IN_SYNCQ(thrd) (((thrd)->sflags & THR_FLAGS_IN_SYNCQ) != 0) 575 | 502}; 503 504#define THR_UMTX_TRYLOCK(thrd, lck) \ 505 _thr_umtx_trylock((lck), (thrd)->tid) 506 507#define THR_UMTX_LOCK(thrd, lck) \ 508 _thr_umtx_lock((lck), (thrd)->tid) 509 --- 66 unchanged lines hidden (view full) --- 576 _gc_count--; \ 577 } \ 578} while (0) 579 580#define GC_NEEDED() (_gc_count >= 5) 581 582#define THR_IN_SYNCQ(thrd) (((thrd)->sflags & THR_FLAGS_IN_SYNCQ) != 0) 583 |
584#define SHOULD_REPORT_EVENT(curthr, e) \ 585 (curthr->report_events && \ 586 (((curthr)->event_mask | _thread_event_mask ) & e) != 0) 587 |
|
576extern int __isthreaded; 577 578/* 579 * Global variables for the pthread kernel. 580 */ 581 582SCLASS void *_usrstack SCLASS_PRESET(NULL); 583SCLASS struct pthread *_thr_initial SCLASS_PRESET(NULL); | 588extern int __isthreaded; 589 590/* 591 * Global variables for the pthread kernel. 592 */ 593 594SCLASS void *_usrstack SCLASS_PRESET(NULL); 595SCLASS struct pthread *_thr_initial SCLASS_PRESET(NULL); |
596SCLASS int _thr_scope_system SCLASS_PRESET(0); 597 |
|
584/* For debugger */ 585SCLASS int _libthr_debug SCLASS_PRESET(0); | 598/* For debugger */ 599SCLASS int _libthr_debug SCLASS_PRESET(0); |
586SCLASS int _thr_scope_system SCLASS_PRESET(0); | 600SCLASS int _thread_event_mask SCLASS_PRESET(0); 601SCLASS struct pthread *_thread_last_event; |
587 588/* List of all threads: */ 589SCLASS TAILQ_HEAD(, pthread) _thread_list 590 SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_list)); 591 592/* List of threads needing GC: */ 593SCLASS TAILQ_HEAD(, pthread) _thread_gc_list 594 SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_gc_list)); --- 43 unchanged lines hidden (view full) --- 638/* Garbage thread count. */ 639SCLASS int _gc_count SCLASS_PRESET(0); 640 641SCLASS umtx_t _mutex_static_lock; 642SCLASS umtx_t _cond_static_lock; 643SCLASS umtx_t _rwlock_static_lock; 644SCLASS umtx_t _keytable_lock; 645SCLASS umtx_t _thr_list_lock; | 602 603/* List of all threads: */ 604SCLASS TAILQ_HEAD(, pthread) _thread_list 605 SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_list)); 606 607/* List of threads needing GC: */ 608SCLASS TAILQ_HEAD(, pthread) _thread_gc_list 609 SCLASS_PRESET(TAILQ_HEAD_INITIALIZER(_thread_gc_list)); --- 43 unchanged lines hidden (view full) --- 653/* Garbage thread count. */ 654SCLASS int _gc_count SCLASS_PRESET(0); 655 656SCLASS umtx_t _mutex_static_lock; 657SCLASS umtx_t _cond_static_lock; 658SCLASS umtx_t _rwlock_static_lock; 659SCLASS umtx_t _keytable_lock; 660SCLASS umtx_t _thr_list_lock; |
661SCLASS umtx_t _thr_event_lock; |
|
646 647/* Undefine the storage class and preset specifiers: */ 648#undef SCLASS 649#undef SCLASS_PRESET 650 651/* 652 * Function prototype definitions. 653 */ --- 61 unchanged lines hidden (view full) --- 715void _thr_list_init(); 716void _thr_hash_add(struct pthread *); 717void _thr_hash_remove(struct pthread *); 718struct pthread *_thr_hash_find(struct pthread *); 719void _thr_link(struct pthread *curthread, struct pthread *thread); 720void _thr_unlink(struct pthread *curthread, struct pthread *thread); 721void _thr_suspend_check(struct pthread *curthread); 722void _thr_assert_lock_level() __dead2; | 662 663/* Undefine the storage class and preset specifiers: */ 664#undef SCLASS 665#undef SCLASS_PRESET 666 667/* 668 * Function prototype definitions. 669 */ --- 61 unchanged lines hidden (view full) --- 731void _thr_list_init(); 732void _thr_hash_add(struct pthread *); 733void _thr_hash_remove(struct pthread *); 734struct pthread *_thr_hash_find(struct pthread *); 735void _thr_link(struct pthread *curthread, struct pthread *thread); 736void _thr_unlink(struct pthread *curthread, struct pthread *thread); 737void _thr_suspend_check(struct pthread *curthread); 738void _thr_assert_lock_level() __dead2; |
739void _thr_report_creation(struct pthread *curthread, 740 struct pthread *newthread); 741void _thr_report_death(struct pthread *curthread); 742void _thread_bp_create(void); 743void _thread_bp_death(void); |
|
723 724/* #include <sys/aio.h> */ 725#ifdef _SYS_AIO_H_ 726int __sys_aio_suspend(const struct aiocb * const[], int, const struct timespec *); 727#endif 728 729/* #include <fcntl.h> */ 730#ifdef _SYS_FCNTL_H_ --- 98 unchanged lines hidden --- | 744 745/* #include <sys/aio.h> */ 746#ifdef _SYS_AIO_H_ 747int __sys_aio_suspend(const struct aiocb * const[], int, const struct timespec *); 748#endif 749 750/* #include <fcntl.h> */ 751#ifdef _SYS_FCNTL_H_ --- 98 unchanged lines hidden --- |