[hurd, commited] htl: Make sure the exit path of last thread sees all thread cleanups
Samuel Thibault
samuel.thibault@ens-lyon.org
Sun Mar 8 17:21:14 GMT 2026
In case e.g. some atexit() handlers expect all threads to have finished
their side effects.
Reported-by: Brent Baccala <cosine@freesoft.org> 's Claude assistant
---
htl/pt-exit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/htl/pt-exit.c b/htl/pt-exit.c
index e08b3252cf..117ea99b7d 100644
--- a/htl/pt-exit.c
+++ b/htl/pt-exit.c
@@ -60,7 +60,7 @@ __pthread_exit (void *status)
/* Decrease the number of threads. We use an atomic operation to
make sure that only the last thread calls `exit'. */
- if (atomic_fetch_add_relaxed (&__pthread_total, -1) == 1)
+ if (atomic_fetch_add_acq_rel (&__pthread_total, -1) == 1)
/* We are the last thread. */
exit (0);
--
2.51.0
More information about the Libc-alpha
mailing list