Hi!
I’m testing this patch:
diff --git a/libguile/gc.c b/libguile/gc.c
index 7816801..97dfcd8 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -730,14 +730,17 @@ queue_after_gc_hook (void * hook_data SCM_UNUSED,
if (scm_debug_cells_gc_interval == 0)
#endif
{
- scm_i_thread *t = SCM_I_CURRENT_THREAD;
-
- if (scm_is_false (SCM_CDR (after_gc_async_cell)))
- {
- SCM_SETCDR (after_gc_async_cell, t->active_asyncs);
- t->active_asyncs = after_gc_async_cell;
- t->pending_asyncs = 1;
- }
+ if (SCM_I_CURRENT_THREAD != NULL && SCM_I_CURRENT_THREAD->guile_mode)
+ {
+ scm_i_thread *t = SCM_I_CURRENT_THREAD;
+
+ if (scm_is_false (SCM_CDR (after_gc_async_cell)))
+ {
+ SCM_SETCDR (after_gc_async_cell, t->active_asyncs);
+ t->active_asyncs = after_gc_async_cell;
+ t->pending_asyncs = 1;
+ }
+ }
}
return NULL;
Rationale:
- With TLS, SCM_I_CURRENT_THREAD is never NULL but the whole struct,
including ‘guile_mode’, is zero when the thread starts.
- Without TLS, SCM_I_CURRENT_THREAD is NULL until ‘guilify_self_1’ has
been called.
Thoughts?
(My “benchmark” has been running for some time already and the bug
hasn’t shown up again.)
Thanks,
Ludo’.