If IMPLEMENT_TAS_WITH_CAS is defined use
authordrepper <drepper>
Sat, 22 Jul 2000 02:24:03 +0000 (02:24 +0000)
committerdrepper <drepper>
Sat, 22 Jul 2000 02:24:03 +0000 (02:24 +0000)
__compare_and_swap to define testandset.

linuxthreads/spinlock.h

index 703b72d..6d3d343 100644 (file)
@@ -48,6 +48,10 @@ static inline int compare_and_swap(long * ptr, long oldval, long newval,
 
 #elif defined(HAS_COMPARE_AND_SWAP)
 
+#ifdef IMPLEMENT_TAS_WITH_CAS
+#define testandset(p) !__compare_and_swap(p, 0, 1)
+#endif
+
 #ifdef HAS_COMPARE_AND_SWAP_WITH_RELEASE_SEMANTICS
 
 static inline int