summaryrefslogtreecommitdiff
path: root/pthread/pt-dealloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'pthread/pt-dealloc.c')
-rw-r--r--pthread/pt-dealloc.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/pthread/pt-dealloc.c b/pthread/pt-dealloc.c
index 1fc7a7b3..879608b9 100644
--- a/pthread/pt-dealloc.c
+++ b/pthread/pt-dealloc.c
@@ -23,10 +23,10 @@
#include <pt-internal.h>
-#include <bits/atomic.h>
+#include <atomic.h>
/* List of thread structures corresponding to free thread IDs. */
-extern __atomicptr_t __pthread_free_threads;
+extern atomicptr_t __pthread_free_threads;
/* Deallocate the thread structure for PTHREAD and the resources
associated with it. */
@@ -54,9 +54,11 @@ __pthread_dealloc (struct __pthread *pthread)
while (1)
{
pthread->next = (struct __pthread *)__pthread_free_threads;
- if (__atomicptr_compare_and_swap (&__pthread_free_threads,
- pthread->next, pthread))
- return;
+ if (atomic_compare_and_exchange_val_acq (&__pthread_free_threads,
+ (uintptr_t) pthread,
+ (uintptr_t) pthread->next)
+ == (uintptr_t) pthread->next)
+ break;
}
/* NOTREACHED */