#include <sys/types.h>
#include <sys/wait.h>
+#include "sbcl.h"
#include "runtime.h"
#include "arch.h"
-#include "sbcl.h"
#include "os.h"
#include "interrupt.h"
#include "globals.h"
signal,info,context))
return;
interrupt_handle_now(signal, info, context);
+#ifdef LISP_FEATURE_DARWIN
+ /* Work around G5 bug */
+ sigreturn(void_context);
+#endif
}
+#ifdef LISP_FEATURE_SB_THREAD
void
sig_stop_for_gc_handler(int signal, siginfo_t *info, void *void_context)
{
os_context_t *context = arch_os_get_context(&void_context);
struct thread *thread=arch_os_get_current_thread();
struct interrupt_data *data=thread->interrupt_data;
-
+ sigset_t ss;
+ int i;
if(maybe_defer_handler(sig_stop_for_gc_handler,data,
- signal,info,context)){
+ signal,info,context)) {
return;
}
/* need the context stored so it can have registers scavenged */
fake_foreign_function_call(context);
+ sigemptyset(&ss);
+ for(i=1;i<NSIG;i++) sigaddset(&ss,i); /* Block everything. */
+ sigprocmask(SIG_BLOCK,&ss,0);
+
get_spinlock(&all_threads_lock,thread->pid);
thread->state=STATE_STOPPED;
release_spinlock(&all_threads_lock);
- kill(thread->pid,SIGSTOP);
+
+ sigemptyset(&ss); sigaddset(&ss,SIG_STOP_FOR_GC);
+ sigwaitinfo(&ss,0);
undo_fake_foreign_function_call(context);
}
+#endif
void
interrupt_handle_now_handler(int signal, siginfo_t *info, void *void_context)
{
os_context_t *context = arch_os_get_context(&void_context);
interrupt_handle_now(signal, info, context);
+#ifdef LISP_FEATURE_DARWIN
+ sigreturn(void_context);
+#endif
}
/*
}
#ifndef LISP_FEATURE_GENCGC
-/* This function gets called from the SIGSEGV (for e.g. Linux or
+/* This function gets called from the SIGSEGV (for e.g. Linux, NetBSD, &
* OpenBSD) or SIGBUS (for e.g. FreeBSD) handler. Here we check
* whether the signal was due to treading on the mprotect()ed zone -
* and if so, arrange for a GC to happen. */