summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libguile/finalizers.c43
-rw-r--r--libguile/finalizers.h5
2 files changed, 0 insertions, 48 deletions
diff --git a/libguile/finalizers.c b/libguile/finalizers.c
index 36159488f..816e87351 100644
--- a/libguile/finalizers.c
+++ b/libguile/finalizers.c
@@ -389,49 +389,6 @@ scm_i_finalizer_pre_fork (void)
-static void
-async_gc_finalizer (void *ptr, void *data)
-{
- void **obj = ptr;
- void (*callback) (void) = obj[0];
-
- callback ();
-
- scm_i_set_finalizer (ptr, async_gc_finalizer, data);
-}
-
-/* Arrange to call CALLBACK asynchronously after each GC. The callback
- will be invoked from a finalizer, which may be from an async or from
- another thread.
-
- As an implementation detail, the way this works is that we allocate a
- fresh object and put the callback in the object. We know that this
- object should get collected the next time GC is run, so we attach a
- finalizer to it to trigger the callback.
-
- Once the callback runs, we re-attach a finalizer to that fresh object
- to prepare for the next GC, and the process repeats indefinitely.
-
- We could use the scm_after_gc_hook, but using a finalizer has the
- advantage of potentially running in another thread, decreasing pause
- time.
-
- Note that libgc currently has a heuristic that adding 500 finalizable
- objects will cause GC to collect rather than expand the heap,
- drastically reducing performance on workloads that actually need to
- expand the heap. Therefore scm_i_register_async_gc_callback is
- inappropriate for using on unbounded numbers of callbacks. */
-void
-scm_i_register_async_gc_callback (void (*callback) (void))
-{
- void **obj = GC_MALLOC_ATOMIC (sizeof (void*));
-
- obj[0] = (void*)callback;
-
- scm_i_set_finalizer (obj, async_gc_finalizer, NULL);
-}
-
-
int
scm_set_automatic_finalization_enabled (int enabled_p)
{
diff --git a/libguile/finalizers.h b/libguile/finalizers.h
index f173dc7a9..3b4ec8af5 100644
--- a/libguile/finalizers.h
+++ b/libguile/finalizers.h
@@ -37,11 +37,6 @@ 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 after each garbage collection. It will be
- called from a finalizer, which may be from an async or from another
- thread. */
-SCM_INTERNAL void scm_i_register_async_gc_callback (void (*callback) (void));
-
/* Return true if THREAD is the finalizer thread. */
SCM_INTERNAL int scm_i_is_finalizer_thread (struct scm_thread *thread);