OS X provides atomic functions in libkern/OSAtomic.h. These provide atomic guarantees and they have alternatives which have barrier semantics. This patch adds proper TSan support for these functions (all from libkern/OSAtomic.h):
- OSAtomicAdd32
- OSAtomicAdd32Barrier
- OSAtomicAdd64
- OSAtomicAdd64Barrier
- OSAtomicAnd32
- OSAtomicAnd32Barrier
- OSAtomicAnd32Orig
- OSAtomicAnd32OrigBarrier
- OSAtomicCompareAndSwap32
- OSAtomicCompareAndSwap32Barrier
- OSAtomicCompareAndSwap64
- OSAtomicCompareAndSwap64Barrier
- OSAtomicCompareAndSwapInt
- OSAtomicCompareAndSwapIntBarrier
- OSAtomicCompareAndSwapLong
- OSAtomicCompareAndSwapLongBarrier
- OSAtomicCompareAndSwapPtr
- OSAtomicCompareAndSwapPtrBarrier
- OSAtomicDecrement32
- OSAtomicDecrement32Barrier
- OSAtomicDecrement64
- OSAtomicDecrement64Barrier
- OSAtomicDequeue
- OSAtomicEnqueue
- OSAtomicFifoDequeue
- OSAtomicFifoEnqueue
- OSAtomicIncrement32
- OSAtomicIncrement32Barrier
- OSAtomicIncrement64
- OSAtomicIncrement64Barrier
- OSAtomicOr32
- OSAtomicOr32Barrier
- OSAtomicOr32Orig
- OSAtomicOr32OrigBarrier
- OSAtomicTestAndClear
- OSAtomicTestAndClearBarrier
- OSAtomicTestAndSet
- OSAtomicTestAndSetBarrier
- OSAtomicXor32
- OSAtomicXor32Barrier
- OSAtomicXor32Orig
- OSAtomicXor32OrigBarrier