summaryrefslogtreecommitdiff
path: root/pthread/pt-alloc.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <marcus@gnu.org>2004-11-01 17:04:00 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-04-06 22:39:57 +0200
commit347e1b07eb34cd37d37c3fd8f4a7e6645f3d0971 (patch)
treee762afbcf92f235bbf45393e67b9f992f62fb034 /pthread/pt-alloc.c
parentad7765721756963ab8bb345c93243e38a65417a3 (diff)
2004-11-01 Marcus Brinkmann <marcus@gnu.org>
* pthread/pt-internal.h: Include <atomic.h>, not <bits/atomic.h>. (__pthread_total): Change type of declaration to uatomic_max_t. * pthread/pt-alloc.c: Include <atomic.h>, not <bits/atomic.h>. (__pthread_free_threads): Change type to uatomicptr_t. (__pthread_alloc): Call atomic_compare_and_exchange_val_acq instead of __atomicptr_compare_and_swap. * pthread/pt-create.c: Include <atomic.h>, not <bits/atomic.h>. (__pthread_total): Change type to uatomic_max_t. (__pthread_create_internal): Call atomic_increment, not __atomic_inc and atomic_decrement, not __atomic_dec. * pthread/pt-dealloc.c: Include <atomic.h>, not <bits/atomic.h>. (__pthread_free_threads): Declare as uatomicptr_t. (__pthread_dealloc): Call atomic_compare_and_exchange_val_acq instead of __atomicptr_compare_and_swap. * pthread/pt-exit.c: Include <atomic.h>, not <bits/atomic.h>. (pthread_exit): Call atomic_decrement_and_test instead of __atomic_dec_and_test. * sysdeps/l4/pt-create-np.c: Do not include <bits/atomic.h>.
Diffstat (limited to 'pthread/pt-alloc.c')
-rw-r--r--pthread/pt-alloc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pthread/pt-alloc.c b/pthread/pt-alloc.c
index 7c15fe1..dd9760d 100644
--- a/pthread/pt-alloc.c
+++ b/pthread/pt-alloc.c
@@ -25,7 +25,7 @@
#include <pt-internal.h>
-#include <bits/atomic.h>
+#include <atomic.h>
/* This braindamage is necessary because the standard says that some
of the threads functions "shall fail" if "No thread could be found
@@ -46,7 +46,7 @@ pthread_rwlock_t __pthread_threads_lock;
/* List of thread structures corresponding to free thread IDs. */
-__atomicptr_t __pthread_free_threads;
+uatomicptr_t __pthread_free_threads;
static inline error_t
initialize_pthread (struct __pthread *new, int recycling)
@@ -97,8 +97,8 @@ __pthread_alloc (struct __pthread **pthread)
/* Try to re-use a thread structure before creating a new one. */
while ((new = (struct __pthread *)__pthread_free_threads))
{
- if (__atomicptr_compare_and_swap (&__pthread_free_threads,
- new, new->next))
+ if (atomic_compare_and_exchange_val_acq (&__pthread_free_threads,
+ new, new->next))
{
/* Yes, we managed to get one. The thread number in the
thread structure still refers to the correct slot. */
@@ -110,8 +110,8 @@ __pthread_alloc (struct __pthread **pthread)
while (1)
{
new->next = (struct __pthread *)__pthread_free_threads;
- if (__atomicptr_compare_and_swap (&__pthread_free_threads,
- new->next, new))
+ if (atomic_compare_and_exchange_val_acq
+ (&__pthread_free_threads, new->next, new))
break;
}