| Index: Source/wtf/Atomics.h
|
| diff --git a/Source/wtf/Atomics.h b/Source/wtf/Atomics.h
|
| index 82113f4abaa3ef8c16e71f8a4bfaefda56f44436..1c86065b4c9cf9e901835c7f8ed8bae7753ef6f1 100644
|
| --- a/Source/wtf/Atomics.h
|
| +++ b/Source/wtf/Atomics.h
|
| @@ -78,6 +78,16 @@ ALWAYS_INLINE void atomicSetOneToZero(int volatile* ptr)
|
| InterlockedExchange(reinterpret_cast<long volatile*>(ptr), 0);
|
| }
|
|
|
| +ALWAYS_INLINE void* atomicTestAndSwap(void* volatile* ptr, void* comprand, void* replacement)
|
| +{
|
| + return InterlockedCompareExchangePointer(ptr, replacement, comprand);
|
| +}
|
| +
|
| +ALWAYS_INLINE void* atomicExchange(void* volatile* ptr, void* value)
|
| +{
|
| + return InterlockedExchangePointer(ptr, value);
|
| +}
|
| +
|
| #else
|
|
|
| // atomicAdd returns the result of the addition.
|
| @@ -103,6 +113,17 @@ ALWAYS_INLINE void atomicSetOneToZero(int volatile* ptr)
|
| ASSERT(*ptr == 1);
|
| __sync_lock_release(ptr);
|
| }
|
| +
|
| +ALWAYS_INLINE void* atomicTestAndSwap(void *volatile* ptr, void* comprand, void* replacement)
|
| +{
|
| + return __sync_val_compare_and_swap(ptr, comprand, replacement);
|
| +}
|
| +
|
| +ALWAYS_INLINE void* atomicExchange(void *volatile* ptr, void* value)
|
| +{
|
| + return __sync_lock_test_and_set(ptr, value);
|
| +}
|
| +
|
| #endif
|
|
|
| #if defined(THREAD_SANITIZER)
|
| @@ -163,10 +184,12 @@ ALWAYS_INLINE int acquireLoad(volatile const int* ptr)
|
| } // namespace WTF
|
|
|
| using WTF::atomicAdd;
|
| -using WTF::atomicSubtract;
|
| using WTF::atomicDecrement;
|
| +using WTF::atomicExchange;
|
| using WTF::atomicIncrement;
|
| using WTF::atomicTestAndSetToOne;
|
| +using WTF::atomicTestAndSwap;
|
| +using WTF::atomicSubtract;
|
| using WTF::atomicSetOneToZero;
|
| using WTF::acquireLoad;
|
| using WTF::releaseStore;
|
|
|