From: Alastair Bridgewater Date: Sat, 7 Aug 2010 13:45:45 +0000 (+0000) Subject: 1.0.41.18: threads: stop_for_gc_handler should check for foriegn contexts X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=c808a8c105050a5384c94418a8c80fafdfdc78c4;p=sbcl.git 1.0.41.18: threads: stop_for_gc_handler should check for foriegn contexts * stop_for_gc_handler() was unconditionally calling fake_foreign_function_call(), even though a thread can legitimately receive SIG_STOP_FOR_GC while in foreign code (and this is even the normal situation when waiting for a mutex or waitqueue). * Use the now-idiomatic was_in_lisp variable fix: Check for an active foreign-function call, only call fake_foreign_function_call if the context is in lisp code, only undo the fake call if the context was in lisp code. --- diff --git a/src/runtime/interrupt.c b/src/runtime/interrupt.c index 9a02e7f..0d426fa 100644 --- a/src/runtime/interrupt.c +++ b/src/runtime/interrupt.c @@ -1185,6 +1185,7 @@ void sig_stop_for_gc_handler(int signal, siginfo_t *info, os_context_t *context) { struct thread *thread=arch_os_get_current_thread(); + boolean was_in_lisp; /* Test for GC_INHIBIT _first_, else we'd trap on every single * pseudo atomic until gc is finally allowed. */ @@ -1205,8 +1206,12 @@ sig_stop_for_gc_handler(int signal, siginfo_t *info, os_context_t *context) /* Not PA and GC not inhibited -- we can stop now. */ - /* need the context stored so it can have registers scavenged */ - fake_foreign_function_call(context); + was_in_lisp = !foreign_function_call_active_p(arch_os_get_current_thread()); + + if (was_in_lisp) { + /* need the context stored so it can have registers scavenged */ + fake_foreign_function_call(context); + } /* Not pending anymore. */ SetSymbolValue(GC_PENDING,NIL,thread); @@ -1251,7 +1256,9 @@ sig_stop_for_gc_handler(int signal, siginfo_t *info, os_context_t *context) fixnum_value(thread_state(thread))); } - undo_fake_foreign_function_call(context); + if (was_in_lisp) { + undo_fake_foreign_function_call(context); + } } #endif diff --git a/version.lisp-expr b/version.lisp-expr index c3d9faf..d82c631 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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.41.17" +"1.0.41.18"