diff options
author | Andy Wingo <wingo@pobox.com> | 2013-01-20 11:55:50 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2013-01-20 12:37:00 +0100 |
commit | a0551390d5a3dd4e9ca0920be9cf0883f36a941e (patch) | |
tree | 0e6a3173515bb3ccb0e30b6f4b7f0de3a33c177a /libguile/finalizers.h | |
parent | d93770763b66990bd989749013b961a1c54c66fd (diff) | |
download | guile-a0551390d5a3dd4e9ca0920be9cf0883f36a941e.tar.gz |
consolidate scm_i_register_weak_gc_callback, update weak-set to fit
* libguile/finalizers.h:
* libguile/finalizers.c (scm_i_register_weak_gc_callback): New internal
helper, from weak-set.c.
Relative to the previous weak-set.c version, prefer the
finalizer-based implementation. Fix bug regarding confusion between
scm_before_gc_c_hook and scm_after_gc_hook. Fix bug regarding
referencing weak values outside of the alloc lock.
* libguile/weak-set.c (GC_move_disappearing_link): New stub.
GC_move_disappearing_link is only available in libgc 7.3.
(move_weak_entry): Use the new stub instead of ifdeffery.
(resize_set): Now that we run finalizers from a separate thread or
async, we can keep the lock while reallocating the set vector.
(do_vacuum_weak_set): For the same reason, always lock the set.
Remove implementation of scm_c_register_weak_gc_callback in preference
of the new copy in finalizers.c.
(scm_c_make_weak_set): Use the new scm_i_register_weak_gc_callback.
Diffstat (limited to 'libguile/finalizers.h')
-rw-r--r-- | libguile/finalizers.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libguile/finalizers.h b/libguile/finalizers.h index ad14d9403..2ef075197 100644 --- a/libguile/finalizers.h +++ b/libguile/finalizers.h @@ -1,7 +1,7 @@ #ifndef SCM_FINALIZERS_H #define SCM_FINALIZERS_H -/* Copyright (C) 2012 Free Software Foundation, Inc. +/* Copyright (C) 2012, 2013 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -36,6 +36,11 @@ SCM_INTERNAL void scm_i_add_resuscitator (void *obj, scm_t_finalizer_proc, SCM_INTERNAL void scm_i_finalizer_pre_fork (void); +/* CALLBACK will be called on OBJ after each garbage collection, as long + as OBJ is accessible. It will be called from a finalizer, which may + be from an async or from another thread. */ +SCM_INTERNAL void scm_i_register_weak_gc_callback (SCM obj, void (*callback) (SCM)); + SCM_INTERNAL void scm_init_finalizers (void); SCM_INTERNAL void scm_init_finalizer_thread (void); |