diff options
author | Andy Wingo <wingo@pobox.com> | 2012-02-24 13:18:48 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2012-02-24 13:33:02 +0100 |
commit | eaf99988aecdcacd9204f61ba1d307584300f751 (patch) | |
tree | 306ba2b7ec442d4a439a00c41e771340a6d8171e /libguile/init.c | |
parent | 415e00fc57e6d734d90b3a7e2324437ccdf406a7 (diff) | |
download | guile-eaf99988aecdcacd9204f61ba1d307584300f751.tar.gz |
run finalizers asynchronously (in asyncs and/or pthreads)
* libguile/finalizers.c: New excitement! We'll be running finalizers in
threads, if that's available. If it's not available, during early
boot, we can run finalizers in asyncs. This will make it safer to
allocate while holding a mutex.
* libguile/posix.c (scm_fork): Shut down the finalizer thread before
forking.
* libguile/init.c (scm_i_init_guile): Init the async finalizer mechanism
during boot and, if available, initialialize the finalizer thread at
the very end.
* libguile/gc.c (scm_storage_prehistory): Tell libgc we'll be finalizing
on demand.
(scm_gc): Explicitly run finalizers here. If you're calling this
function, you probably want synchronous GC.
Diffstat (limited to 'libguile/init.c')
-rw-r--r-- | libguile/init.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libguile/init.c b/libguile/init.c index dc3f5ece1..90b01eedb 100644 --- a/libguile/init.c +++ b/libguile/init.c @@ -59,6 +59,7 @@ #include "libguile/expand.h" #include "libguile/feature.h" #include "libguile/filesys.h" +#include "libguile/finalizers.h" #include "libguile/fluids.h" #include "libguile/fports.h" #include "libguile/frames.h" @@ -421,6 +422,7 @@ scm_i_init_guile (void *base) scm_init_dynwind (); /* requires smob_prehistory */ scm_init_eq (); scm_init_error (); + scm_init_finalizers (); scm_init_fluids (); scm_init_control (); /* requires fluids */ scm_init_feature (); @@ -529,6 +531,9 @@ scm_i_init_guile (void *base) /* Capture the dynamic state after loading boot-9, so that new threads end up in the guile-user module. */ scm_init_threads_default_dynamic_state (); + + /* Finally, cause finalizers to run in a separate thread. */ + scm_init_finalizer_thread (); } /* |