commit 60d1b9b9198bc8c618596cb0e48687bd41e8adb7 Author: Jeremie Koenig Date: Fri Jun 10 05:46:39 2011 +0000 Mark new threads as global signal receivers * sysdeps/mach/hurd/pt-sigstate-init.c (__pthread_sigstate_init): Call _hurd_sigstate_set_global_rcv for newly created threads. * sysdeps/mach/pt-thread-halt.c (__pthread_thread_halt): Call _hurd_sigstate_delete on terminated threads. diff --git a/libpthread/sysdeps/mach/hurd/pt-sigstate-init.c b/libpthread/sysdeps/mach/hurd/pt-sigstate-init.c index da5a945..f8398f4 100644 --- a/libpthread/sysdeps/mach/hurd/pt-sigstate-init.c +++ b/libpthread/sysdeps/mach/hurd/pt-sigstate-init.c @@ -19,6 +19,7 @@ #include #include +#include #include @@ -30,8 +31,21 @@ __pthread_sigstate_init (struct __pthread *thread) thread->stackaddr); /* The real initialization happens internally in glibc the first - time that _hurd_thead_sigstate is called. */ + time that _hurd_self_sigstate is called. */ *location = 0; + /* Mark the thread as a global signal receiver so as to conform with + the pthread semantics. However, we must be careful. The first + pthread created is the main thread, during libpthread initialization. + We must not mark it, otherwise the sigprocmask call in + __pthread_create would try to access _hurd_global_sigstate, + which is not initialized yet. When glibc runs _hurdsig_init later + on, the message thread is created, which must not be marked either. */ + if (__pthread_num_threads > 2) + { + struct hurd_sigstate *ss = _hurd_thread_sigstate (thread->kernel_thread); + _hurd_sigstate_set_global_rcv (ss); + } + return 0; } diff --git a/libpthread/sysdeps/mach/pt-thread-halt.c b/libpthread/sysdeps/mach/pt-thread-halt.c index a9c3858..808043d 100644 --- a/libpthread/sysdeps/mach/pt-thread-halt.c +++ b/libpthread/sysdeps/mach/pt-thread-halt.c @@ -34,6 +34,8 @@ __pthread_thread_halt (struct __pthread *thread) { if (thread->have_kernel_resources) { + _hurd_sigstate_delete (thread->kernel_thread); + if (thread == _pthread_self ()) { while (1)