-
- /* mark this thread as suspended and remember the PC */
- thread->pc = pc;
- thread->suspended = true;
-
- /* if we are stopping the world, we should send a global ack */
- if (thread->suspend_reason == SUSPEND_REASON_STOPWORLD) {
- threads_sem_post(&suspend_ack);
+ else {
+ // Send the suspend signal to the other thread.
+ if (pthread_kill(thread->tid, SIGUSR1) != 0)
+ os::abort_errno("threads_suspend_thread: pthread_kill failed");
+
+ // Wait for the thread to acknowledge the suspension.
+ // XXX A possible optimization would be to not wait here, but you
+ // better think this through twice before trying it!
+ thread->suspendcond->wait(thread->suspendmutex);