diff options
Diffstat (limited to 'pthread/pt-alloc.c')
-rw-r--r-- | pthread/pt-alloc.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/pthread/pt-alloc.c b/pthread/pt-alloc.c index 6cf9106b..30dcede0 100644 --- a/pthread/pt-alloc.c +++ b/pthread/pt-alloc.c @@ -1,5 +1,5 @@ /* Allocate a new thread structure. - Copyright (C) 2000, 2002, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,7 +25,7 @@ #include <pt-internal.h> -#include <atomic.h> +#include <bits/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; +__atomicptr_t __pthread_free_threads; static inline error_t initialize_pthread (struct __pthread *new, int recycling) @@ -97,10 +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 (atomic_compare_and_exchange_val_acq (&__pthread_free_threads, - (uintptr_t) new->next, - (uintptr_t) new) - == (uintptr_t) new) + if (__atomicptr_compare_and_swap (&__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. */ @@ -112,10 +110,8 @@ __pthread_alloc (struct __pthread **pthread) while (1) { new->next = (struct __pthread *)__pthread_free_threads; - if (atomic_compare_and_exchange_val_acq - (&__pthread_free_threads, - (uintptr_t) new, (uintptr_t) new->next) - == (uintptr_t) new->next) + if (__atomicptr_compare_and_swap (&__pthread_free_threads, + new->next, new)) break; } |