1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Exclude the finalizer thread from the ‘all-threads’ result.

Fixes <https://bugs.gnu.org/76343>.

Fixes a bug whereby “echo '(environ)' | guile” would wrongfully trigger
the multiple-thread warning.

* libguile/finalizers.c (finalizer_thread): New variable.
(finalization_thread_proc): Set it.
(scm_i_is_finalizer_thread): New function.
(run_finalization_thread): Clear FINALIZER_THREAD.
* libguile/finalizers.h (scm_i_is_finalizer_thread): New declaration.
* libguile/threads.c (scm_all_threads): Use it.
* NEWS: Update.

Reported-by: Simon Josefsson <simon@josefsson.org>
This commit is contained in:
Ludovic Courtès 2025-02-26 15:48:41 +01:00
parent 75fd1d6434
commit b8031fc965
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
4 changed files with 34 additions and 7 deletions

View file

@ -1,7 +1,7 @@
#ifndef SCM_FINALIZERS_H
#define SCM_FINALIZERS_H
/* Copyright 2012, 2013, 2014, 2018
/* Copyright 2012, 2013, 2014, 2018, 2025
Free Software Foundation, Inc.
This file is part of Guile.
@ -42,6 +42,9 @@ SCM_INTERNAL void scm_i_finalizer_pre_fork (void);
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);
SCM_API int scm_set_automatic_finalization_enabled (int enabled_p);
SCM_API int scm_run_finalizers (void);