summaryrefslogtreecommitdiffstats
path: root/lib/libpthread/uthread/uthread_init.c
diff options
context:
space:
mode:
authorfgsch <fgsch@openbsd.org>2001-08-29 18:33:54 +0000
committerfgsch <fgsch@openbsd.org>2001-08-29 18:33:54 +0000
commit2f42962d8efccfcc45eeac677be278a1dfcdfb4c (patch)
treef4bbe006e421cca9b2c60793b439571ac9b4095e /lib/libpthread/uthread/uthread_init.c
parentNope, this makes cvs dump core (diff)
downloadwireguard-openbsd-2f42962d8efccfcc45eeac677be278a1dfcdfb4c.tar.xz
wireguard-openbsd-2f42962d8efccfcc45eeac677be278a1dfcdfb4c.zip
More sync with FreeBSD.
Diffstat (limited to 'lib/libpthread/uthread/uthread_init.c')
-rw-r--r--lib/libpthread/uthread/uthread_init.c72
1 files changed, 4 insertions, 68 deletions
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)