about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/htl/pt-docancel.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/htl/pt-docancel.c')
-rw-r--r--sysdeps/mach/hurd/htl/pt-docancel.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sysdeps/mach/hurd/htl/pt-docancel.c b/sysdeps/mach/hurd/htl/pt-docancel.c
index 93961060a2..52010b6edf 100644
--- a/sysdeps/mach/hurd/htl/pt-docancel.c
+++ b/sysdeps/mach/hurd/htl/pt-docancel.c
@@ -17,6 +17,7 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <pthread.h>
+#include <hurd/signal.h>
 
 #include <pt-internal.h>
 #include <pthreadP.h>
@@ -47,10 +48,16 @@ __pthread_do_cancel (struct __pthread *p)
   else
     {
       error_t err;
+      struct hurd_sigstate *ss = _hurd_thread_sigstate (p->kernel_thread);
+
+      __spin_lock (&ss->critical_section_lock);
+      __spin_lock (&ss->lock);
 
       err = __thread_suspend (p->kernel_thread);
       assert_perror (err);
 
+      __spin_unlock (&ss->lock);
+
       err = __thread_abort (p->kernel_thread);
       assert_perror (err);
 
@@ -60,6 +67,8 @@ __pthread_do_cancel (struct __pthread *p)
 
       err = __thread_resume (p->kernel_thread);
       assert_perror (err);
+
+      _hurd_critical_section_unlock (ss);
     }
 
   return 0;