about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-12-13 23:05:35 +0000
committerUlrich Drepper <drepper@redhat.com>2002-12-13 23:05:35 +0000
commit3b7c07d8f2a4ab7317a630c3240e2fc5f5d4e681 (patch)
treeff154aa44f9b484997fb27bdb995bd6f60b3afce
parentb7bdd9c4c9b808f9678fb81b74f9347e7464240d (diff)
downloadglibc-3b7c07d8f2a4ab7317a630c3240e2fc5f5d4e681.tar.gz
glibc-3b7c07d8f2a4ab7317a630c3240e2fc5f5d4e681.tar.xz
glibc-3b7c07d8f2a4ab7317a630c3240e2fc5f5d4e681.zip
(test_loaded): Don't overwrite a value another thread might have found.
-rw-r--r--nptl/forward.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/nptl/forward.c b/nptl/forward.c
index 441a7f25ea..6c278c0690 100644
--- a/nptl/forward.c
+++ b/nptl/forward.c
@@ -22,6 +22,7 @@
 #include <stdlib.h>
 
 #include <shlib-compat.h>
+#include <atomic.h>
 
 
 #if SHLIB_COMPAT(libc, GLIBC_2_0, GLIBC_2_3_2)
@@ -33,7 +34,7 @@ test_loaded (void)
 {
   /* While we are getting the result set the handle to (void *) -1 to
      avoid recursive calls.  */
-  libpthread_handle = (void *) -1l;
+  atomic_compare_and_exchange_acq (&libpthread_handle, (void *) -1l, NULL);
 
   void *h = __libc_dlopen_mode ("libpthread.so.0", RTLD_LAZY | RTLD_NOLOAD);