sem_t GC_restart_ack_sem;
#endif
-void GC_suspend_handler_inner(ptr_t sig_arg);
+void GC_suspend_handler_inner(ptr_t sig_arg, void *context);
/* int cacao_suspendhandler(void *); */
-#if defined(IA64) || defined(HP_PA)
-extern void GC_with_callee_saves_pushed();
-
-void GC_suspend_handler(int sig)
+#if defined(IA64) || defined(HP_PA) || defined(M68K)
+void GC_suspend_handler(int sig, siginfo_t *info, void *context)
{
-- int old_errno = errno;
-- GC_with_callee_saves_pushed(GC_suspend_handler_inner, (ptr_t)(word)sig);
-- errno = old_errno;
++ int old_errno = errno;
++ GC_with_callee_saves_pushed(GC_suspend_handler_inner, (ptr_t)(word)sig);
++ errno = old_errno;
}
-
#else
-/* We believe that in all other cases the full context is already */
-/* in the signal handler frame. */
-void GC_suspend_handler(int sig, siginfo_t *info, void *uctx)
+/* We believe that in all other cases the full context is already */
+/* in the signal handler frame. */
+void GC_suspend_handler(int sig, siginfo_t *info, void *context)
{
-- int old_errno = errno;
-
- /* if (cacao_suspendhandler(uctx)) */
- /* return; */
--
- GC_suspend_handler_inner((ptr_t)(word)sig, context);
- GC_suspend_handler_inner((ptr_t)(word)sig);
-- errno = old_errno;
++ int old_errno = errno;
++ GC_suspend_handler_inner((ptr_t)(word)sig, context);
++ errno = old_errno;
}
#endif
-
-void GC_suspend_handler_inner(ptr_t sig_arg)
+
+void GC_suspend_handler_inner(ptr_t sig_arg, void *context)
{
int sig = (int)(word)sig_arg;
int dummy;
int n_live_threads;
int code;
- #if DEBUG_THREADS
- GC_printf1("Stopping the world from 0x%lx\n", pthread_self());
- #endif
-
+ GC_ASSERT(I_HOLD_LOCK());
+# if DEBUG_THREADS
+ GC_printf("Stopping the world from 0x%x\n", (unsigned)pthread_self());
+# endif
-
- lock_stopworld(1);
+
/* Make sure all free list construction has stopped before we start. */
/* No new construction can start, since free list construction is */
/* required to acquire and release the GC lock before it starts, */
}
}
}
-#ifdef GC_NETBSD_THREADS_WORKAROUND
- for (i = 0; i < n_live_threads; i++)
+# ifdef GC_NETBSD_THREADS_WORKAROUND
+ for (i = 0; i < n_live_threads; i++)
while (0 != (code = sem_wait(&GC_restart_ack_sem)))
if (errno != EINTR) {
- GC_err_printf1("sem_wait() returned %ld\n", (unsigned long)code);
+ GC_err_printf1("sem_wait() returned %ld\n",
+ (unsigned long)code);
ABORT("sem_wait() for restart handler failed");
}
-#endif
-
- #if DEBUG_THREADS
- GC_printf0("World started\n");
- #endif
+# endif
-
- unlock_stopworld();
-
+# if DEBUG_THREADS
+ GC_printf("World started\n");
+# endif
}
void GC_stop_init() {