diff options
Diffstat (limited to 'sysdeps/mach')
-rw-r--r-- | sysdeps/mach/hurd/htl/pt-sysdep.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.c b/sysdeps/mach/hurd/htl/pt-sysdep.c index 55b1a86e00..030a7c7a9e 100644 --- a/sysdeps/mach/hurd/htl/pt-sysdep.c +++ b/sysdeps/mach/hurd/htl/pt-sysdep.c @@ -26,6 +26,10 @@ #include <pt-internal.h> #include <pthreadP.h> +/* Initial thread structure used temporarily during initialization, so various + * functions can already work at least basically. */ +static struct __pthread init_thread; + static void reset_pthread_total (void) { @@ -47,6 +51,10 @@ _init_routine (void *stack) /* Already initialized */ return; + /* Initialize early thread structure. */ + init_thread.thread = 1; + ___pthread_self = &init_thread; + /* Initialize the library. */ ___pthread_init (); @@ -74,6 +82,12 @@ _init_routine (void *stack) __pthread_default_attr.__guardsize = __vm_page_size; #endif + /* Copy over the thread-specific state */ + assert (!init_thread.thread_specifics); + memcpy (&thread->static_thread_specifics, + &init_thread.static_thread_specifics, + sizeof (thread->static_thread_specifics)); + ___pthread_self = thread; /* Decrease the number of threads, to take into account that the |