diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-07-04 00:22:32 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-07-04 00:22:32 +0000 |
commit | 4ad1d0cfbf96c3dbcf0ba104eb9f81bae6bdc6da (patch) | |
tree | e9cd4db68a06582802d945faf432460e54ceea82 /linuxthreads/spinlock.h | |
parent | 68eefde7b626b57d5fde40980084feda77c89801 (diff) | |
download | glibc-4ad1d0cfbf96c3dbcf0ba104eb9f81bae6bdc6da.zip glibc-4ad1d0cfbf96c3dbcf0ba104eb9f81bae6bdc6da.tar.gz glibc-4ad1d0cfbf96c3dbcf0ba104eb9f81bae6bdc6da.tar.bz2 |
(charmap_read): Prepend the condition filename == NULL.
Diffstat (limited to 'linuxthreads/spinlock.h')
-rw-r--r-- | linuxthreads/spinlock.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/linuxthreads/spinlock.h b/linuxthreads/spinlock.h index 1145c72..96f3955 100644 --- a/linuxthreads/spinlock.h +++ b/linuxthreads/spinlock.h @@ -81,6 +81,7 @@ static inline int compare_and_swap(long * ptr, long oldval, long newval, #ifndef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS #define compare_and_swap_with_release_semantics compare_and_swap +#define __compare_and_swap_with_release_semantics __compare_and_swap #endif /* Internal locks */ @@ -97,13 +98,26 @@ static inline void __pthread_init_lock(struct _pthread_fastlock * lock) static inline int __pthread_trylock (struct _pthread_fastlock * lock) { +#if defined HAS_COMPARE_AND_SWAP long oldstatus; +#endif +#if defined TEST_FOR_COMPARE_AND_SWAP + if (!__pthread_has_cas) +#endif +#if !defined HAS_COMPARE_AND_SWAP + { + return (testandset(&lock->__spinlock) : EBUSY : 0) + } +#endif + +#if defined HAS_COMPARE_AND_SWAP do { oldstatus = lock->__status; if (oldstatus != 0) return EBUSY; } while(! compare_and_swap(&lock->__status, 0, 1, &lock->__spinlock)); return 0; +#endif } /* Variation of internal lock used for pthread_mutex_t, supporting |