diff options
Diffstat (limited to 'linuxthreads/spinlock.h')
-rw-r--r-- | linuxthreads/spinlock.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/linuxthreads/spinlock.h b/linuxthreads/spinlock.h index 2d3e9bf..9fbeff1 100644 --- a/linuxthreads/spinlock.h +++ b/linuxthreads/spinlock.h @@ -12,6 +12,8 @@ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU Library General Public License for more details. */ +#include <bits/initspin.h> + /* There are 2 compare and swap synchronization primitives with different semantics: @@ -97,7 +99,7 @@ extern int __pthread_unlock(struct _pthread_fastlock *lock); static inline void __pthread_init_lock(struct _pthread_fastlock * lock) { lock->__status = 0; - lock->__spinlock = 0; + lock->__spinlock = LT_SPINLOCK_INIT; } static inline int __pthread_trylock (struct _pthread_fastlock * lock) @@ -139,7 +141,7 @@ extern void __pthread_alt_unlock(struct _pthread_fastlock *lock); static inline void __pthread_alt_init_lock(struct _pthread_fastlock * lock) { lock->__status = 0; - lock->__spinlock = 0; + lock->__spinlock = LT_SPINLOCK_INIT; } static inline int __pthread_alt_trylock (struct _pthread_fastlock * lock) @@ -163,7 +165,7 @@ static inline int __pthread_alt_trylock (struct _pthread_fastlock * lock) WRITE_MEMORY_BARRIER(); res = 0; } - lock->__spinlock = 0; + lock->__spinlock = LT_SPINLOCK_INIT; } return res; } @@ -178,11 +180,6 @@ static inline int __pthread_alt_trylock (struct _pthread_fastlock * lock) #endif } -/* Initializers for both lock variants */ - -#define LOCK_INITIALIZER {0, 0} -#define ALT_LOCK_INITIALIZER {0, 0} - /* Operations on pthread_atomic, which is defined in internals.h */ static inline long atomic_increment(struct pthread_atomic *pa) @@ -208,8 +205,6 @@ static inline long atomic_decrement(struct pthread_atomic *pa) return oldval; } -#define ATOMIC_INITIALIZER { 0, 0 } - static inline void __pthread_set_own_extricate_if (pthread_descr self, pthread_extricate_if *peif) |