diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-08-29 18:33:55 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2001-08-29 18:33:55 +0000 |
commit | 05536921e8cc58554ab25ff86d52c2addd3677fa (patch) | |
tree | 2a08e250e0fed387d62bcb7d103994c12b7fef44 | |
parent | 06a9b4ae025b29369a583bbdbce22b3017e7b190 (diff) |
More sync with FreeBSD.
-rw-r--r-- | lib/libc_r/uthread/pthread_private.h | 212 | ||||
-rw-r--r-- | lib/libc_r/uthread/uthread_init.c | 72 | ||||
-rw-r--r-- | lib/libpthread/uthread/pthread_private.h | 212 | ||||
-rw-r--r-- | lib/libpthread/uthread/uthread_init.c | 72 |
4 files changed, 372 insertions, 196 deletions
diff --git a/lib/libc_r/uthread/pthread_private.h b/lib/libc_r/uthread/pthread_private.h index 9487d13586c..e0436a477ea 100644 --- a/lib/libc_r/uthread/pthread_private.h +++ b/lib/libc_r/uthread/pthread_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_private.h,v 1.24 2001/08/26 00:49:03 fgsch Exp $ */ +/* $OpenBSD: pthread_private.h,v 1.25 2001/08/29 18:33:54 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>. * All rights reserved. @@ -39,6 +39,15 @@ #define _PTHREAD_PRIVATE_H /* + * Evaluate the storage class specifier. + */ +#ifdef GLOBAL_PTHREAD_PRIVATE +#define SCLASS +#else +#define SCLASS extern +#endif + +/* * Include files. */ #include <signal.h> @@ -783,94 +792,229 @@ void _thread_machdep_restore_float_state(struct _machdep_state* statep); */ /* Kernel thread structure used when there are no running threads: */ -extern struct pthread _thread_kern_thread; +SCLASS struct pthread _thread_kern_thread; /* Ptr to the thread structure for the running thread: */ -extern struct pthread * volatile _thread_run; +SCLASS struct pthread * volatile _thread_run +#ifdef GLOBAL_PTHREAD_PRIVATE += &_thread_kern_thread; +#else +; +#endif /* Ptr to the thread structure for the last user thread to run: */ -extern struct pthread * volatile _last_user_thread; +SCLASS struct pthread * volatile _last_user_thread +#ifdef GLOBAL_PTHREAD_PRIVATE += &_thread_kern_thread; +#else +; +#endif /* * Ptr to the thread running in single-threaded mode or NULL if * running multi-threaded (default POSIX behaviour). */ -extern struct pthread * volatile _thread_single; +SCLASS struct pthread * volatile _thread_single +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL; +#else +; +#endif -extern _thread_list_t _thread_list; +SCLASS _thread_list_t _thread_list +#ifdef GLOBAL_PTHREAD_PRIVATE += TAILQ_HEAD_INITIALIZER(_thread_list); +#else +; +#endif /* * Array of kernel pipe file descriptors that are used to ensure that * no signals are missed in calls to _select. */ -extern int _thread_kern_pipe[2]; -extern volatile int _queue_signals; -extern volatile int _thread_kern_in_sched; +SCLASS int _thread_kern_pipe[2] +#ifdef GLOBAL_PTHREAD_PRIVATE += { + -1, + -1 +}; +#else +; +#endif +SCLASS int volatile _queue_signals +#ifdef GLOBAL_PTHREAD_PRIVATE += 0; +#else +; +#endif +SCLASS int volatile _thread_kern_in_sched +#ifdef GLOBAL_PTHREAD_PRIVATE += 0; +#else +; +#endif + +SCLASS int _sig_in_handler +#ifdef GLOBAL_PTHREAD_PRIVATE += 0; +#else +; +#endif + +/* Time of day at last scheduling timer signal: */ +SCLASS struct timeval volatile _sched_tod +#ifdef GLOBAL_PTHREAD_PRIVATE += { 0, 0 }; +#else +; +#endif + +/* + * Current scheduling timer ticks; used as resource usage. + */ +SCLASS unsigned int volatile _sched_ticks +#ifdef GLOBAL_PTHREAD_PRIVATE += 0; +#else +; +#endif /* Last time that an incremental priority update was performed: */ extern struct timeval kern_inc_prio_time; /* Dead threads: */ -extern _thread_list_t _dead_list; +SCLASS _thread_list_t _dead_list +#ifdef GLOBAL_PTHREAD_PRIVATE += TAILQ_HEAD_INITIALIZER(_dead_list); +#else +; +#endif /* Initial thread: */ -extern struct pthread *_thread_initial; +SCLASS struct pthread *_thread_initial +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL; +#else +; +#endif /* Default thread attributes: */ -extern struct pthread_attr pthread_attr_default; +SCLASS struct pthread_attr pthread_attr_default +#ifdef GLOBAL_PTHREAD_PRIVATE += { SCHED_RR, 0, TIMESLICE_USEC, PTHREAD_DEFAULT_PRIORITY, + PTHREAD_CREATE_RUNNING, PTHREAD_CREATE_JOINABLE, NULL, NULL, NULL, + PTHREAD_STACK_DEFAULT }; +#else +; +#endif /* Default mutex attributes: */ -extern struct pthread_mutex_attr pthread_mutexattr_default; +SCLASS struct pthread_mutex_attr pthread_mutexattr_default +#ifdef GLOBAL_PTHREAD_PRIVATE += { PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, 0 }; +#else +; +#endif /* Default condition variable attributes: */ -extern struct pthread_cond_attr pthread_condattr_default; +SCLASS struct pthread_cond_attr pthread_condattr_default +#ifdef GLOBAL_PTHREAD_PRIVATE += { COND_TYPE_FAST, 0 }; +#else +; +#endif /* * Standard I/O file descriptors need special flag treatment since * setting one to non-blocking does all on *BSD. Sigh. This array * is used to store the initial flag settings. */ -extern int _pthread_stdio_flags[3]; +SCLASS int _pthread_stdio_flags[3]; /* File table information: */ -extern struct fd_table_entry **_thread_fd_table; +SCLASS struct fd_table_entry **_thread_fd_table +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL; +#else +; +#endif /* Table for polling file descriptors: */ -extern struct pollfd *_thread_pfd_table; +SCLASS struct pollfd *_thread_pfd_table +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL; +#else +; +#endif -extern const int dtablecount; -extern int _thread_dtablesize; /* Descriptor table size. */ +SCLASS const int dtablecount +#ifdef GLOBAL_PTHREAD_PRIVATE += 4096/sizeof(struct fd_table_entry); +#else +; +#endif +SCLASS int _thread_dtablesize /* Descriptor table size. */ +#ifdef GLOBAL_PTHREAD_PRIVATE += 0; +#else +; +#endif -extern int _clock_res_nsec; /* Clock resolution in nsec. */ +SCLASS int _clock_res_nsec /* Clock resolution in nsec. */ +#ifdef GLOBAL_PTHREAD_PRIVATE += CLOCK_RES_NSEC; +#else +; +#endif /* Garbage collector mutex and condition variable. */ -extern pthread_mutex_t _gc_mutex; -extern pthread_cond_t _gc_cond; +SCLASS pthread_mutex_t _gc_mutex +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL +#endif +; +SCLASS pthread_cond_t _gc_cond +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL +#endif +; /* * Array of signal actions for this process. */ -extern struct sigaction _thread_sigact[NSIG]; +SCLASS struct sigaction _thread_sigact[NSIG]; /* * Scheduling queues: */ -extern pq_queue_t _readyq; -extern _thread_list_t _waitingq; +SCLASS pq_queue_t _readyq; +SCLASS _thread_list_t _waitingq; /* * Work queue: */ -extern _thread_list_t _workq; +SCLASS _thread_list_t _workq; /* Tracks the number of threads blocked while waiting for a spinlock. */ -extern volatile int _spinblock_count; +SCLASS volatile int _spinblock_count +#ifdef GLOBAL_PTHREAD_PRIVATE += 0 +#endif +; /* Indicates that the signal queue needs to be checked. */ -extern volatile int _sigq_check_reqd; +SCLASS volatile int _sigq_check_reqd +#ifdef GLOBAL_PTHREAD_PRIVATE += 0 +#endif +; /* Thread switch hook. */ -extern pthread_switch_routine_t _sched_switch_hook; +SCLASS pthread_switch_routine_t _sched_switch_hook +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL +#endif +; /* * Spare stack queue. Stacks of default size are cached in order to reduce @@ -881,7 +1025,15 @@ typedef SLIST_HEAD(, stack) _stack_list_t; extern _stack_list_t _stackq; /* Used for _PTHREADS_INVARIANTS checking. */ -extern int _thread_kern_new_state; +SCLASS int _thread_kern_new_state +#ifdef GLOBAL_PTHREAD_PRIVATE += 0; +#else +; +#endif + +/* Undefine the storage class specifier: */ +#undef SCLASS /* * Function prototype definitions. diff --git a/lib/libc_r/uthread/uthread_init.c b/lib/libc_r/uthread/uthread_init.c index ef5a1bbd9f2..edf87469bd0 100644 --- a/lib/libc_r/uthread/uthread_init.c +++ b/lib/libc_r/uthread/uthread_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_init.c,v 1.12 2000/02/26 13:30:49 d Exp $ */ +/* $OpenBSD: uthread_init.c,v 1.13 2001/08/29 18:33:54 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -33,6 +33,9 @@ * $FreeBSD: uthread_init.c,v 1.18 1999/08/28 00:03:36 peter Exp $ */ +/* Allocate space for global thread variables here: */ +#define GLOBAL_PTHREAD_PRIVATE + #include <errno.h> #include <stdlib.h> #include <string.h> @@ -54,69 +57,11 @@ #include "pthread_private.h" /* Global thread variables. */ -struct pthread _thread_kern_thread; -struct pthread *volatile _thread_run = &_thread_kern_thread; -struct pthread *volatile _last_user_thread = &_thread_kern_thread; -struct pthread *volatile _thread_single = NULL; -_thread_list_t _thread_list = TAILQ_HEAD_INITIALIZER(_thread_list); -int _thread_kern_pipe[2] = { -1, -1 }; -volatile int _queue_signals = 0; -volatile int _thread_kern_in_sched = 0; struct timeval kern_inc_prio_time = { 0, 0 }; -_thread_list_t _dead_list = TAILQ_HEAD_INITIALIZER(_dead_list); -struct pthread *_thread_initial = NULL; -struct pthread_attr pthread_attr_default = { - SCHED_RR, 0, TIMESLICE_USEC, PTHREAD_DEFAULT_PRIORITY, - PTHREAD_CREATE_RUNNING, PTHREAD_CREATE_JOINABLE, - NULL, NULL, NULL, PTHREAD_STACK_DEFAULT }; -struct pthread_mutex_attr pthread_mutexattr_default = { - PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, 0 }; -struct pthread_cond_attr pthread_condattr_default = { COND_TYPE_FAST, 0 }; -int _pthread_stdio_flags[3]; -struct fd_table_entry **_thread_fd_table = NULL; -struct pollfd *_thread_pfd_table = NULL; -const int dtablecount = 4096/sizeof(struct fd_table_entry); -int _thread_dtablesize = 0; -int _clock_res_nsec = CLOCK_RES_NSEC; -pthread_mutex_t _gc_mutex = NULL; -pthread_cond_t _gc_cond = NULL; -struct sigaction _thread_sigact[NSIG]; -pq_queue_t _readyq; -_thread_list_t _waitingq; -_thread_list_t _workq; -volatile int _spinblock_count = 0; -volatile int _sigq_check_reqd = 0; -pthread_switch_routine_t _sched_switch_hook = NULL; _stack_list_t _stackq; -int _thread_kern_new_state = 0; extern int _thread_autoinit_dummy_decl; -#ifdef GCC_2_8_MADE_THREAD_AWARE -typedef void *** (*dynamic_handler_allocator)(); -extern void __set_dynamic_handler_allocator(dynamic_handler_allocator); - -static pthread_key_t except_head_key; - -typedef struct { - void **__dynamic_handler_chain; - void *top_elt[2]; -} except_struct; - -static void ***dynamic_allocator_handler_fn() -{ - except_struct *dh = (except_struct *)pthread_getspecific(except_head_key); - - if(dh == NULL) { - dh = (except_struct *)malloc( sizeof(except_struct) ); - memset(dh, '\0', sizeof(except_struct)); - dh->__dynamic_handler_chain= dh->top_elt; - pthread_setspecific(except_head_key, (void *)dh); - } - return &dh->__dynamic_handler_chain; -} -#endif /* GCC_2_8_MADE_THREAD_AWARE */ - /* * Threaded process initialization */ @@ -358,15 +303,6 @@ _thread_init(void) } } -#ifdef GCC_2_8_MADE_THREAD_AWARE - /* Create the thread-specific data for the exception linked list. */ - if(pthread_key_create(&except_head_key, NULL) != 0) - PANIC("Failed to create thread specific execption head"); - - /* Setup the gcc exception handler per thread. */ - __set_dynamic_handler_allocator( dynamic_allocator_handler_fn ); -#endif /* GCC_2_8_MADE_THREAD_AWARE */ - /* Initialise the garbage collector mutex and condition variable. */ if (pthread_mutex_init(&_gc_mutex,NULL) != 0 || pthread_cond_init(&_gc_cond,NULL) != 0) diff --git a/lib/libpthread/uthread/pthread_private.h b/lib/libpthread/uthread/pthread_private.h index 9487d13586c..e0436a477ea 100644 --- a/lib/libpthread/uthread/pthread_private.h +++ b/lib/libpthread/uthread/pthread_private.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread_private.h,v 1.24 2001/08/26 00:49:03 fgsch Exp $ */ +/* $OpenBSD: pthread_private.h,v 1.25 2001/08/29 18:33:54 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>. * All rights reserved. @@ -39,6 +39,15 @@ #define _PTHREAD_PRIVATE_H /* + * Evaluate the storage class specifier. + */ +#ifdef GLOBAL_PTHREAD_PRIVATE +#define SCLASS +#else +#define SCLASS extern +#endif + +/* * Include files. */ #include <signal.h> @@ -783,94 +792,229 @@ void _thread_machdep_restore_float_state(struct _machdep_state* statep); */ /* Kernel thread structure used when there are no running threads: */ -extern struct pthread _thread_kern_thread; +SCLASS struct pthread _thread_kern_thread; /* Ptr to the thread structure for the running thread: */ -extern struct pthread * volatile _thread_run; +SCLASS struct pthread * volatile _thread_run +#ifdef GLOBAL_PTHREAD_PRIVATE += &_thread_kern_thread; +#else +; +#endif /* Ptr to the thread structure for the last user thread to run: */ -extern struct pthread * volatile _last_user_thread; +SCLASS struct pthread * volatile _last_user_thread +#ifdef GLOBAL_PTHREAD_PRIVATE += &_thread_kern_thread; +#else +; +#endif /* * Ptr to the thread running in single-threaded mode or NULL if * running multi-threaded (default POSIX behaviour). */ -extern struct pthread * volatile _thread_single; +SCLASS struct pthread * volatile _thread_single +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL; +#else +; +#endif -extern _thread_list_t _thread_list; +SCLASS _thread_list_t _thread_list +#ifdef GLOBAL_PTHREAD_PRIVATE += TAILQ_HEAD_INITIALIZER(_thread_list); +#else +; +#endif /* * Array of kernel pipe file descriptors that are used to ensure that * no signals are missed in calls to _select. */ -extern int _thread_kern_pipe[2]; -extern volatile int _queue_signals; -extern volatile int _thread_kern_in_sched; +SCLASS int _thread_kern_pipe[2] +#ifdef GLOBAL_PTHREAD_PRIVATE += { + -1, + -1 +}; +#else +; +#endif +SCLASS int volatile _queue_signals +#ifdef GLOBAL_PTHREAD_PRIVATE += 0; +#else +; +#endif +SCLASS int volatile _thread_kern_in_sched +#ifdef GLOBAL_PTHREAD_PRIVATE += 0; +#else +; +#endif + +SCLASS int _sig_in_handler +#ifdef GLOBAL_PTHREAD_PRIVATE += 0; +#else +; +#endif + +/* Time of day at last scheduling timer signal: */ +SCLASS struct timeval volatile _sched_tod +#ifdef GLOBAL_PTHREAD_PRIVATE += { 0, 0 }; +#else +; +#endif + +/* + * Current scheduling timer ticks; used as resource usage. + */ +SCLASS unsigned int volatile _sched_ticks +#ifdef GLOBAL_PTHREAD_PRIVATE += 0; +#else +; +#endif /* Last time that an incremental priority update was performed: */ extern struct timeval kern_inc_prio_time; /* Dead threads: */ -extern _thread_list_t _dead_list; +SCLASS _thread_list_t _dead_list +#ifdef GLOBAL_PTHREAD_PRIVATE += TAILQ_HEAD_INITIALIZER(_dead_list); +#else +; +#endif /* Initial thread: */ -extern struct pthread *_thread_initial; +SCLASS struct pthread *_thread_initial +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL; +#else +; +#endif /* Default thread attributes: */ -extern struct pthread_attr pthread_attr_default; +SCLASS struct pthread_attr pthread_attr_default +#ifdef GLOBAL_PTHREAD_PRIVATE += { SCHED_RR, 0, TIMESLICE_USEC, PTHREAD_DEFAULT_PRIORITY, + PTHREAD_CREATE_RUNNING, PTHREAD_CREATE_JOINABLE, NULL, NULL, NULL, + PTHREAD_STACK_DEFAULT }; +#else +; +#endif /* Default mutex attributes: */ -extern struct pthread_mutex_attr pthread_mutexattr_default; +SCLASS struct pthread_mutex_attr pthread_mutexattr_default +#ifdef GLOBAL_PTHREAD_PRIVATE += { PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, 0 }; +#else +; +#endif /* Default condition variable attributes: */ -extern struct pthread_cond_attr pthread_condattr_default; +SCLASS struct pthread_cond_attr pthread_condattr_default +#ifdef GLOBAL_PTHREAD_PRIVATE += { COND_TYPE_FAST, 0 }; +#else +; +#endif /* * Standard I/O file descriptors need special flag treatment since * setting one to non-blocking does all on *BSD. Sigh. This array * is used to store the initial flag settings. */ -extern int _pthread_stdio_flags[3]; +SCLASS int _pthread_stdio_flags[3]; /* File table information: */ -extern struct fd_table_entry **_thread_fd_table; +SCLASS struct fd_table_entry **_thread_fd_table +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL; +#else +; +#endif /* Table for polling file descriptors: */ -extern struct pollfd *_thread_pfd_table; +SCLASS struct pollfd *_thread_pfd_table +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL; +#else +; +#endif -extern const int dtablecount; -extern int _thread_dtablesize; /* Descriptor table size. */ +SCLASS const int dtablecount +#ifdef GLOBAL_PTHREAD_PRIVATE += 4096/sizeof(struct fd_table_entry); +#else +; +#endif +SCLASS int _thread_dtablesize /* Descriptor table size. */ +#ifdef GLOBAL_PTHREAD_PRIVATE += 0; +#else +; +#endif -extern int _clock_res_nsec; /* Clock resolution in nsec. */ +SCLASS int _clock_res_nsec /* Clock resolution in nsec. */ +#ifdef GLOBAL_PTHREAD_PRIVATE += CLOCK_RES_NSEC; +#else +; +#endif /* Garbage collector mutex and condition variable. */ -extern pthread_mutex_t _gc_mutex; -extern pthread_cond_t _gc_cond; +SCLASS pthread_mutex_t _gc_mutex +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL +#endif +; +SCLASS pthread_cond_t _gc_cond +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL +#endif +; /* * Array of signal actions for this process. */ -extern struct sigaction _thread_sigact[NSIG]; +SCLASS struct sigaction _thread_sigact[NSIG]; /* * Scheduling queues: */ -extern pq_queue_t _readyq; -extern _thread_list_t _waitingq; +SCLASS pq_queue_t _readyq; +SCLASS _thread_list_t _waitingq; /* * Work queue: */ -extern _thread_list_t _workq; +SCLASS _thread_list_t _workq; /* Tracks the number of threads blocked while waiting for a spinlock. */ -extern volatile int _spinblock_count; +SCLASS volatile int _spinblock_count +#ifdef GLOBAL_PTHREAD_PRIVATE += 0 +#endif +; /* Indicates that the signal queue needs to be checked. */ -extern volatile int _sigq_check_reqd; +SCLASS volatile int _sigq_check_reqd +#ifdef GLOBAL_PTHREAD_PRIVATE += 0 +#endif +; /* Thread switch hook. */ -extern pthread_switch_routine_t _sched_switch_hook; +SCLASS pthread_switch_routine_t _sched_switch_hook +#ifdef GLOBAL_PTHREAD_PRIVATE += NULL +#endif +; /* * Spare stack queue. Stacks of default size are cached in order to reduce @@ -881,7 +1025,15 @@ typedef SLIST_HEAD(, stack) _stack_list_t; extern _stack_list_t _stackq; /* Used for _PTHREADS_INVARIANTS checking. */ -extern int _thread_kern_new_state; +SCLASS int _thread_kern_new_state +#ifdef GLOBAL_PTHREAD_PRIVATE += 0; +#else +; +#endif + +/* Undefine the storage class specifier: */ +#undef SCLASS /* * Function prototype definitions. diff --git a/lib/libpthread/uthread/uthread_init.c b/lib/libpthread/uthread/uthread_init.c index ef5a1bbd9f2..edf87469bd0 100644 --- a/lib/libpthread/uthread/uthread_init.c +++ b/lib/libpthread/uthread/uthread_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uthread_init.c,v 1.12 2000/02/26 13:30:49 d Exp $ */ +/* $OpenBSD: uthread_init.c,v 1.13 2001/08/29 18:33:54 fgsch Exp $ */ /* * Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au> * All rights reserved. @@ -33,6 +33,9 @@ * $FreeBSD: uthread_init.c,v 1.18 1999/08/28 00:03:36 peter Exp $ */ +/* Allocate space for global thread variables here: */ +#define GLOBAL_PTHREAD_PRIVATE + #include <errno.h> #include <stdlib.h> #include <string.h> @@ -54,69 +57,11 @@ #include "pthread_private.h" /* Global thread variables. */ -struct pthread _thread_kern_thread; -struct pthread *volatile _thread_run = &_thread_kern_thread; -struct pthread *volatile _last_user_thread = &_thread_kern_thread; -struct pthread *volatile _thread_single = NULL; -_thread_list_t _thread_list = TAILQ_HEAD_INITIALIZER(_thread_list); -int _thread_kern_pipe[2] = { -1, -1 }; -volatile int _queue_signals = 0; -volatile int _thread_kern_in_sched = 0; struct timeval kern_inc_prio_time = { 0, 0 }; -_thread_list_t _dead_list = TAILQ_HEAD_INITIALIZER(_dead_list); -struct pthread *_thread_initial = NULL; -struct pthread_attr pthread_attr_default = { - SCHED_RR, 0, TIMESLICE_USEC, PTHREAD_DEFAULT_PRIORITY, - PTHREAD_CREATE_RUNNING, PTHREAD_CREATE_JOINABLE, - NULL, NULL, NULL, PTHREAD_STACK_DEFAULT }; -struct pthread_mutex_attr pthread_mutexattr_default = { - PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, 0 }; -struct pthread_cond_attr pthread_condattr_default = { COND_TYPE_FAST, 0 }; -int _pthread_stdio_flags[3]; -struct fd_table_entry **_thread_fd_table = NULL; -struct pollfd *_thread_pfd_table = NULL; -const int dtablecount = 4096/sizeof(struct fd_table_entry); -int _thread_dtablesize = 0; -int _clock_res_nsec = CLOCK_RES_NSEC; -pthread_mutex_t _gc_mutex = NULL; -pthread_cond_t _gc_cond = NULL; -struct sigaction _thread_sigact[NSIG]; -pq_queue_t _readyq; -_thread_list_t _waitingq; -_thread_list_t _workq; -volatile int _spinblock_count = 0; -volatile int _sigq_check_reqd = 0; -pthread_switch_routine_t _sched_switch_hook = NULL; _stack_list_t _stackq; -int _thread_kern_new_state = 0; extern int _thread_autoinit_dummy_decl; -#ifdef GCC_2_8_MADE_THREAD_AWARE -typedef void *** (*dynamic_handler_allocator)(); -extern void __set_dynamic_handler_allocator(dynamic_handler_allocator); - -static pthread_key_t except_head_key; - -typedef struct { - void **__dynamic_handler_chain; - void *top_elt[2]; -} except_struct; - -static void ***dynamic_allocator_handler_fn() -{ - except_struct *dh = (except_struct *)pthread_getspecific(except_head_key); - - if(dh == NULL) { - dh = (except_struct *)malloc( sizeof(except_struct) ); - memset(dh, '\0', sizeof(except_struct)); - dh->__dynamic_handler_chain= dh->top_elt; - pthread_setspecific(except_head_key, (void *)dh); - } - return &dh->__dynamic_handler_chain; -} -#endif /* GCC_2_8_MADE_THREAD_AWARE */ - /* * Threaded process initialization */ @@ -358,15 +303,6 @@ _thread_init(void) } } -#ifdef GCC_2_8_MADE_THREAD_AWARE - /* Create the thread-specific data for the exception linked list. */ - if(pthread_key_create(&except_head_key, NULL) != 0) - PANIC("Failed to create thread specific execption head"); - - /* Setup the gcc exception handler per thread. */ - __set_dynamic_handler_allocator( dynamic_allocator_handler_fn ); -#endif /* GCC_2_8_MADE_THREAD_AWARE */ - /* Initialise the garbage collector mutex and condition variable. */ if (pthread_mutex_init(&_gc_mutex,NULL) != 0 || pthread_cond_init(&_gc_cond,NULL) != 0) |