1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 04:10:18 +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,4 +1,4 @@
/* Copyright 1995-1998,2000-2014,2018-2019,2023-2024
/* Copyright 1995-1998,2000-2014,2018-2019,2023-2025
Free Software Foundation, Inc.
This file is part of Guile.
@ -47,6 +47,7 @@
#include "dynwind.h"
#include "eval.h"
#include "extensions.h"
#include "finalizers.h"
#include "fluids.h"
#include "gc-inline.h"
#include "gc.h"
@ -1691,7 +1692,9 @@ SCM_DEFINE (scm_all_threads, "all-threads", 0, 0, 0,
for (t = all_threads; t && n > 0; t = t->next_thread)
{
if (!t->exited && !scm_i_is_signal_delivery_thread (t))
if (!t->exited
&& !scm_i_is_signal_delivery_thread (t)
&& !scm_i_is_finalizer_thread (t))
{
SCM_SETCAR (*l, t->handle);
l = SCM_CDRLOC (*l);