about summary refs log tree commit diff
path: root/nptl/pthread_create.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-09-05 17:18:23 +0000
committerUlrich Drepper <drepper@redhat.com>2006-09-05 17:18:23 +0000
commitb051fc4438e7e7ef248a1d03a9b2bd397bc916f3 (patch)
tree0d6d7a6030bafb9f43c5cc2f0a32a1d49a0e7626 /nptl/pthread_create.c
parentd052233c6cc886f472736f3cd8f79e4ecf6e0c89 (diff)
downloadglibc-b051fc4438e7e7ef248a1d03a9b2bd397bc916f3.tar.gz
glibc-b051fc4438e7e7ef248a1d03a9b2bd397bc916f3.tar.xz
glibc-b051fc4438e7e7ef248a1d03a9b2bd397bc916f3.zip
[BZ #3124]
2006-09-05  Ulrich Drepper  <drepper@redhat.com>
	[BZ #3124]
	* descr.h (struct pthread): Add parent_cancelhandling.
	* sysdeps/pthread/createthread.c (create_thread): Pass parent
	cancelhandling value to child.
	* pthread_create.c (start_thread): If parent thread was canceled
	reset the SIGCANCEL mask.
	* Makefile (tests): Add tst-cancel25.
	* tst-cancel25.c: New file.
Diffstat (limited to 'nptl/pthread_create.c')
-rw-r--r--nptl/pthread_create.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c
index 315722643b..79729ced03 100644
--- a/nptl/pthread_create.c
+++ b/nptl/pthread_create.c
@@ -251,6 +251,19 @@ start_thread (void *arg)
     }
 #endif
 
+  /* If the parent was running cancellation handlers while creating
+     the thread the new thread inherited the signal mask.  Reset the
+     cancellation signal mask.  */
+  if (__builtin_expect (pd->parent_cancelhandling & CANCELING_BITMASK, 0))
+    {
+      INTERNAL_SYSCALL_DECL (err);
+      sigset_t mask;
+      __sigemptyset (&mask);
+      __sigaddset (&mask, SIGCANCEL);
+      (void) INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_UNBLOCK, &mask,
+			       NULL, _NSIG / 8);
+    }
+
   /* This is where the try/finally block should be created.  For
      compilers without that support we do use setjmp.  */
   struct pthread_unwind_buf unwind_buf;