about summary refs log tree commit diff
path: root/hurd/thread-cancel.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2000-07-25 21:43:38 +0000
committerMark Kettenis <kettenis@gnu.org>2000-07-25 21:43:38 +0000
commit2d3d740b6fe77f280bc49d93242386abf43230fa (patch)
treec91907456aaddf00a072f341211f6f9f1c013ccf /hurd/thread-cancel.c
parenta3b231b751694620419c112a240fc20663015596 (diff)
downloadglibc-2d3d740b6fe77f280bc49d93242386abf43230fa.tar.gz
glibc-2d3d740b6fe77f280bc49d93242386abf43230fa.tar.xz
glibc-2d3d740b6fe77f280bc49d93242386abf43230fa.zip
* hurd/thread-cancel.c (hurd_thread_cancel): When cancelling the calling thread, set the cancellation flag and return success instead of EINTR.
2000-07-25  Mark Kettenis  <kettenis@gnu.org>

	* hurd/thread-cancel.c (hurd_thread_cancel): When cancelling the
	calling thread, set the cancellation flag and return success
	instead of EINTR.
Diffstat (limited to 'hurd/thread-cancel.c')
-rw-r--r--hurd/thread-cancel.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/hurd/thread-cancel.c b/hurd/thread-cancel.c
index 9791268e33..6eaa62ea09 100644
--- a/hurd/thread-cancel.c
+++ b/hurd/thread-cancel.c
@@ -1,5 +1,5 @@
 /* Thread cancellation support.
-   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -43,7 +43,14 @@ hurd_thread_cancel (thread_t thread)
   if (! ss)
     return EINVAL;
   if (ss == _hurd_self_sigstate ())
-    return EINTR;		/* Bozo.  */
+    {
+      /* We are cancelling ourselves, so it is easy to succeed
+	 quickly.  Since this function is not a cancellation point, we
+	 just leave the flag set pending the next cancellation point
+	 (hurd_check_cancel or RPC) and return success.  */
+      ss->cancel = 1;
+      return 0;
+    }
 
   assert (! __spin_lock_locked (&ss->critical_section_lock));
   __spin_lock (&ss->critical_section_lock);