diff options
Diffstat (limited to 'libguile/async.c')
-rw-r--r-- | libguile/async.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/libguile/async.c b/libguile/async.c index 7a942270e..1409d155a 100644 --- a/libguile/async.c +++ b/libguile/async.c @@ -43,7 +43,15 @@ #include <stdio.h> #include <signal.h> #include "_scm.h" +#include "eval.h" +#include "throw.h" +#include "smob.h" +#include "async.h" + +#ifdef HAVE_STRING_H +#include <string.h> +#endif #ifdef HAVE_UNISTD_H #include <unistd.h> #endif @@ -294,13 +302,13 @@ scm_deliver_signal (num) #ifdef __STDC__ static int -print_async (SCM exp, SCM port, int writing) +print_async (SCM exp, SCM port, scm_print_state *pstate) #else static int -print_async (exp, port, writing) +print_async (exp, port, pstate) SCM exp; SCM port; - int writing; + scm_print_state *pstate; #endif { scm_gen_puts (scm_regular_string, "#<async ", port); @@ -652,10 +660,18 @@ scm_take_signal (n) SCM ignored; if (!scm_ints_disabled) { - SCM_NEWCELL (ignored); /* In case we interrupted SCM_NEWCELL, - * throw out the possibly already allocated - * free cell. - */ + /* For reasons of speed, the SCM_NEWCELL macro doesn't defer + interrupts. Instead, it first sets its argument to point to + the first cell in the list, and then advances the freelist + pointer to the next cell. Now, if this procedure is + interrupted, the only anomalous state possible is to have + both SCM_NEWCELL's argument and scm_freelist pointing to the + same cell. To deal with this case, we always throw away the + first cell in scm_freelist here. + + At least, that's the theory. I'm not convinced that that's + the only anomalous path we need to worry about. */ + SCM_NEWCELL (ignored); } scm_system_async_mark (system_signal_asyncs[SCM_SIG_ORD(n)]); return SCM_BOOL_F; @@ -702,7 +718,7 @@ scm_init_async () { SCM a_thunk; scm_tc16_async = scm_newsmob (&async_smob); - symbol_signal = SCM_CAR (scm_sysintern ("signal", strlen ("signal"))); + symbol_signal = SCM_CAR (scm_sysintern ("signal", SCM_UNDEFINED)); scm_permanent_object (symbol_signal); /* These are in the opposite order of delivery priortity. @@ -730,7 +746,7 @@ scm_init_async () a_thunk = scm_make_gsubr ("%alrm-thunk", 0, 0, 0, scm_sys_alrm_async_thunk); system_signal_asyncs[SCM_SIG_ORD(SCM_ALRM_SIGNAL)] = scm_system_async (a_thunk); - handler_var = scm_sysintern ("signal-handler", strlen ("signal")); + handler_var = scm_sysintern ("signal-handler", SCM_UNDEFINED); SCM_SETCDR (handler_var, SCM_BOOL_F); scm_permanent_object (handler_var); #include "async.x" |