In case e.g. some atexit() handlers expect all threads to have finished
their side effects.

Reported-by: Brent Baccala <[email protected]> '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


Reply via email to