diff options
author | Andy Wingo <wingo@pobox.com> | 2012-03-08 13:22:09 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2012-03-08 13:22:09 +0100 |
commit | bc612809929b85fdcb39bc17a15a53c88b43a8bd (patch) | |
tree | 14444f0fb0f69cf9db6b7bf1493c780488c47093 /libguile/finalizers.c | |
parent | c336514976ed3f2b2b20c56149ede7f5ec549c52 (diff) | |
parent | f740445a9b5bf0a5e5090f0a2ddaffb2b803bab7 (diff) | |
download | guile-bc612809929b85fdcb39bc17a15a53c88b43a8bd.tar.gz |
Merge remote-tracking branch 'local-2.0/stable-2.0'
Conflicts:
configure.ac
libguile/finalizers.c
libguile/finalizers.h
libguile/gc.c
libguile/gc.h
libguile/inline.c
libguile/inline.h
libguile/ports.c
libguile/smob.c
libguile/smob.h
module/ice-9/deprecated.scm
module/ice-9/r4rs.scm
Diffstat (limited to 'libguile/finalizers.c')
-rw-r--r-- | libguile/finalizers.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/libguile/finalizers.c b/libguile/finalizers.c index 07d8f0748..25aadf431 100644 --- a/libguile/finalizers.c +++ b/libguile/finalizers.c @@ -43,6 +43,17 @@ static size_t finalization_count; +#ifndef HAVE_GC_SET_FINALIZER_NOTIFIER +static void +GC_set_finalizer_notifier (void (*notifier) (void)) +{ + GC_finalizer_notifier = notifier; +} +#endif + + + + void scm_i_set_finalizer (void *obj, scm_t_finalizer_proc proc, void *data) { @@ -142,10 +153,9 @@ run_finalizers_async_thunk (void) } -/* The function queue_after_gc_hook is run by the scm_before_gc_c_hook - * at the end of the garbage collection. The only purpose of this - * function is to mark the after_gc_async (which will eventually lead to - * the execution of the after_gc_async_thunk). +/* The function queue_finalizer_async is run by the GC when there are + * objects to finalize. It will enqueue an asynchronous call to + * GC_invoke_finalizers() at the next SCM_TICK in this thread. */ static void queue_finalizer_async (void) @@ -154,7 +164,10 @@ queue_finalizer_async (void) static scm_i_pthread_mutex_t lock = SCM_I_PTHREAD_MUTEX_INITIALIZER; scm_i_pthread_mutex_lock (&lock); - if (scm_is_false (SCM_CDR (finalizer_async_cell))) + /* If t is NULL, that could be because we're allocating in + threads.c:guilify_self_1. In that case, rely on the + GC_invoke_finalizers call there after the thread spins up. */ + if (t && scm_is_false (SCM_CDR (finalizer_async_cell))) { SCM_SETCDR (finalizer_async_cell, t->active_asyncs); t->active_asyncs = finalizer_async_cell; |