mirror of
git://sourceware.org/git/glibc.git
synced 2026-09-08 23:58:31 +08:00
htl: Make sure the exit path of last thread sees all thread cleanups
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
This commit is contained in:
+1
-1
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user