diff options
Diffstat (limited to 'sysdeps/mach/pt-thread-halt.c')
-rw-r--r-- | sysdeps/mach/pt-thread-halt.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sysdeps/mach/pt-thread-halt.c b/sysdeps/mach/pt-thread-halt.c index 973cde1..a9c3858 100644 --- a/sysdeps/mach/pt-thread-halt.c +++ b/sysdeps/mach/pt-thread-halt.c @@ -32,6 +32,21 @@ void __pthread_thread_halt (struct __pthread *thread) { - error_t err = __thread_terminate (thread->kernel_thread); - assert_perror (err); + if (thread->have_kernel_resources) + { + if (thread == _pthread_self ()) + { + while (1) + { + error_t err = __thread_suspend (thread->kernel_thread); + assert_perror (err); + assert (! "Failed to suspend self."); + } + } + else + { + error_t err = __thread_terminate (thread->kernel_thread); + assert_perror (err); + } + } } |