- if (p -> stop_info.last_stop_count == GC_stop_count) continue;
- if (p -> thread_blocked) /* Will wait */ continue;
- n_live_threads++;
-# if DEBUG_THREADS
- GC_printf("Sending suspend signal to 0x%x\n",
- (unsigned)(p -> id));
-# endif
-
- result = pthread_kill(p -> id, SIG_SUSPEND);
- switch(result) {
+ if (p -> thread_blocked) /* Will wait */ continue;
+# ifndef GC_OPENBSD_THREADS
+ if (p -> stop_info.last_stop_count == GC_stop_count) continue;
+ n_live_threads++;
+# endif
+# ifdef DEBUG_THREADS
+ GC_printf("Sending suspend signal to 0x%x\n",
+ (unsigned)(p -> id));
+# endif
+
+# ifdef GC_OPENBSD_THREADS
+ if (pthread_suspend_np(p -> id) != 0)
+ ABORT("pthread_suspend_np failed");
+ /* This will only work for userland pthreads. It will */
+ /* fail badly on rthreads. Perhaps we should consider */
+ /* a pthread_sp_np() function that returns the stack */
+ /* pointer for a suspended thread and implement in both */
+ /* pthreads and rthreads. */
+ p -> stop_info.stack_ptr =
+ *(ptr_t *)((char *)p -> id + UTHREAD_SP_OFFSET);
+# else
+ result = pthread_kill(p -> id, SIG_SUSPEND);
+ switch(result) {