about summary refs log tree commit diff
path: root/linuxthreads/cancel.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-12-18 01:38:17 +0000
committerUlrich Drepper <drepper@redhat.com>2002-12-18 01:38:17 +0000
commit82f81a9086320d12eb2fc45766203954b90461a2 (patch)
treeb2c668e5ee6bc1e9c4176cee394ac7f37b382617 /linuxthreads/cancel.c
parentf077a4a9f027b938bd091583e3ec34725cba428c (diff)
downloadglibc-82f81a9086320d12eb2fc45766203954b90461a2.tar.gz
glibc-82f81a9086320d12eb2fc45766203954b90461a2.tar.xz
glibc-82f81a9086320d12eb2fc45766203954b90461a2.zip
Update.
	* sysdeps/unix/sysv/linux/alpha/syscalls.list (msgrcv, msgsnd):
	Make cancelable.
	* sysdeps/unix/sysv/linux/hppa/syscalls.list (msgrcv, msgsnd):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/syscalls.list (msgrcv, msgsnd):
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list (msgrcv, msgsnd):
	Likewise.
	* sysdeps/unix/sysv/linux/x86_64/syscalls.list (msgrcv, msgsnd):
	Likewise.
	* sysdeps/unix/sysv/linux/ia64/sigsuspend.c (__sigsuspend): Likewise.
Diffstat (limited to 'linuxthreads/cancel.c')
-rw-r--r--linuxthreads/cancel.c43
1 files changed, 30 insertions, 13 deletions
diff --git a/linuxthreads/cancel.c b/linuxthreads/cancel.c
index 47c0bfee04..838f55d8b2 100644
--- a/linuxthreads/cancel.c
+++ b/linuxthreads/cancel.c
@@ -30,7 +30,7 @@
 #endif
 
 
-int pthread_setcancelstate(int state, int * oldstate)
+int __pthread_setcancelstate(int state, int * oldstate)
 {
   pthread_descr self = thread_self();
   if (state < PTHREAD_CANCEL_ENABLE || state > PTHREAD_CANCEL_DISABLE)
@@ -43,8 +43,9 @@ int pthread_setcancelstate(int state, int * oldstate)
     __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
   return 0;
 }
+strong_alias (__pthread_setcancelstate, pthread_setcancelstate);
 
-int pthread_setcanceltype(int type, int * oldtype)
+int __pthread_setcanceltype(int type, int * oldtype)
 {
   pthread_descr self = thread_self();
   if (type < PTHREAD_CANCEL_DEFERRED || type > PTHREAD_CANCEL_ASYNCHRONOUS)
@@ -57,6 +58,33 @@ int pthread_setcanceltype(int type, int * oldtype)
     __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
   return 0;
 }
+strong_alias (__pthread_setcanceltype, pthread_setcanceltype);
+
+
+/* The next two functions are similar to pthread_setcanceltype() but
+   more specialized for the use in the cancelable functions like write().
+   They do not need to check parameters etc.  */
+int
+attribute_hidden
+__pthread_enable_asynccancel (void)
+{
+  pthread_descr self = thread_self();
+  int oldtype = THREAD_GETMEM(self, p_canceltype);
+  THREAD_SETMEM(self, p_canceltype, PTHREAD_CANCEL_ASYNCHRONOUS);
+  if (__builtin_expect (THREAD_GETMEM(self, p_canceled), 0) &&
+      THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE)
+    __pthread_do_exit(PTHREAD_CANCELED, CURRENT_STACK_FRAME);
+  return oldtype;
+}
+
+void
+internal_function attribute_hidden
+__pthread_disable_asynccancel (int oldtype)
+{
+  pthread_descr self = thread_self();
+  THREAD_SETMEM(self, p_canceltype, oldtype);
+}
+
 
 int pthread_cancel(pthread_t thread)
 {
@@ -210,14 +238,3 @@ void __pthread_perform_cleanup(char *currentframe)
     __rpc_thread_destroy ();
 #endif
 }
-
-#ifndef SHARED
-/* We need a hook to force the cancelation wrappers and file locking
-   to be linked in when static libpthread is used.  */
-extern const int __pthread_provide_wrappers;
-static const int *const __pthread_require_wrappers =
-  &__pthread_provide_wrappers;
-extern const int __pthread_provide_lockfile;
-static const int *const __pthread_require_lockfile =
-  &__pthread_provide_lockfile;
-#endif