[hurd, commited] htl: Make sure the exit path of last thread sees all thread cleanups

Samuel Thibault <[email protected]>
Newsgroups gmane.os.hurd.cvs,gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.