about summary refs log tree commit diff
path: root/nptl/pthread_cancel.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2014-11-20 13:43:35 -0800
committerRoland McGrath <roland@hack.frob.com>2014-11-20 13:43:35 -0800
commit2f531bbb7b0458a303e8969f1e830467ca684443 (patch)
tree28b2c5b70b7b886e4b910edd3cfe6b1d19fdba34 /nptl/pthread_cancel.c
parentf214ff74f46275f6f1187730ac88b8a2407393f3 (diff)
downloadglibc-2f531bbb7b0458a303e8969f1e830467ca684443.tar.gz
glibc-2f531bbb7b0458a303e8969f1e830467ca684443.tar.xz
glibc-2f531bbb7b0458a303e8969f1e830467ca684443.zip
NPTL: Conditionalize asynchronous cancellation support on [SIGCANCEL].
Diffstat (limited to 'nptl/pthread_cancel.c')
-rw-r--r--nptl/pthread_cancel.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
index aeba1ff823..5e645e46ed 100644
--- a/nptl/pthread_cancel.c
+++ b/nptl/pthread_cancel.c
@@ -18,8 +18,9 @@
 
 #include <errno.h>
 #include <signal.h>
+#include <stdlib.h>
 #include "pthreadP.h"
-#include "atomic.h"
+#include <atomic.h>
 #include <sysdep.h>
 
 
@@ -63,6 +64,7 @@ pthread_cancel (th)
 						    oldval))
 	    goto again;
 
+#ifdef SIGCANCEL
 	  /* The cancellation handler will take care of marking the
 	     thread as canceled.  */
 	  INTERNAL_SYSCALL_DECL (err);
@@ -80,13 +82,20 @@ pthread_cancel (th)
 
 	  if (INTERNAL_SYSCALL_ERROR_P (val, err))
 	    result = INTERNAL_SYSCALL_ERRNO (val, err);
+#else
+          /* It should be impossible to get here at all, since
+             pthread_setcanceltype should never have allowed
+             PTHREAD_CANCEL_ASYNCHRONOUS to be set.  */
+          abort ();
+#endif
 
 	  break;
 	}
 
-	/* A single-threaded process should be able to kill itself, since there is
-	   nothing in the POSIX specification that says that it cannot.  So we set
-	   multiple_threads to true so that cancellation points get executed.  */
+	/* A single-threaded process should be able to kill itself, since
+	   there is nothing in the POSIX specification that says that it
+	   cannot.  So we set multiple_threads to true so that cancellation
+	   points get executed.  */
 	THREAD_SETMEM (THREAD_SELF, header.multiple_threads, 1);
 #ifndef TLS_MULTIPLE_THREADS_IN_TCB
 	__pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;