1.0.26.10: darwin interrupt fixes
authorGabor Melis <mega@hotpop.com>
Fri, 20 Mar 2009 11:15:17 +0000 (11:15 +0000)
committerGabor Melis <mega@hotpop.com>
Fri, 20 Mar 2009 11:15:17 +0000 (11:15 +0000)
Work around raise(signal) apparently not raising the signal under some
circumstances. See sbcl-devel thread "Hang in tests on Intel MacOS
10.5.6" starting on 2009-03-14.

Also, block all blockables when in install_handler, having just one of
the signals blocked breaks invariants (not really darwin specific).

Replace abort() after the call mach_msg_server() with more a
informative lose(). It's actually returns after attaching and
detaching gdb.

src/runtime/interrupt.c
src/runtime/thread.c
src/runtime/x86-64-darwin-os.c
src/runtime/x86-darwin-os.c
version.lisp-expr

index dc210e9..305f75f 100644 (file)
@@ -406,7 +406,8 @@ check_interrupt_context_or_lose(os_context_t *context)
         lose("gc_blocked_deferrables and interrupt pending\n.");
     if (data->gc_blocked_deferrables)
         check_deferrables_blocked_in_sigset_or_lose(sigset);
-    if (interrupt_pending || interrupt_deferred_p)
+    if (interrupt_pending || interrupt_deferred_p ||
+        data->gc_blocked_deferrables)
         check_deferrables_blocked_in_sigset_or_lose(sigset);
     else {
         check_deferrables_unblocked_in_sigset_or_lose(sigset);
@@ -1604,9 +1605,7 @@ install_handler(int signal, void handler(int, siginfo_t*, os_context_t*))
 
     FSHOW((stderr, "/entering POSIX install_handler(%d, ..)\n", signal));
 
-    sigemptyset(&new);
-    sigaddset(&new, signal);
-    thread_sigmask(SIG_BLOCK, &new, &old);
+    thread_sigmask(SIG_BLOCK, &blockable_sigset, &old);
 
     FSHOW((stderr, "/interrupt_low_level_handlers[signal]=%x\n",
            (unsigned int)interrupt_low_level_handlers[signal]));
index f8cb1ca..1da1108 100644 (file)
@@ -721,7 +721,18 @@ kill_safely(os_thread_t os_thread, int signal)
         int status;
         if (os_thread != 0)
             lose("kill_safely: who do you want to kill? %d?\n", os_thread);
+        /* Dubious (as in don't know why it works) workaround for the
+         * signal sometimes not being generated on darwin. */
+#ifdef LISP_FEATURE_DARWIN
+        {
+            sigset_t oldset;
+            sigprocmask(SIG_BLOCK, &deferrable_sigset, &oldset);
+            status = raise(signal);
+            sigprocmask(SIG_SETMASK,&oldset,0);
+        }
+#else
         status = raise(signal);
+#endif
         if (status == 0) {
             return 0;
         } else {
index 35ac2f9..046a125 100644 (file)
@@ -579,7 +579,7 @@ mach_exception_handler(void *port)
   /* mach_msg_server should never return, but it should dispatch mach
    * exceptions to our catch_exception_raise function
    */
-  abort();
+  lose("mach_msg_server returned");
 }
 
 /* Sets up the thread that will listen for mach exceptions. note that
index 1cc837c..c657565 100644 (file)
@@ -514,7 +514,7 @@ mach_exception_handler(void *port)
   /* mach_msg_server should never return, but it should dispatch mach
    * exceptions to our catch_exception_raise function
    */
-  abort();
+  lose("mach_msg_server returned");
 }
 
 #endif
index e80cc75..b5cc8c4 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.26.9"
+"1.0.26.10"