diff options
Diffstat (limited to 'lib/system/atomics.nim')
-rw-r--r-- | lib/system/atomics.nim | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/system/atomics.nim b/lib/system/atomics.nim index 9111c072a..633348034 100644 --- a/lib/system/atomics.nim +++ b/lib/system/atomics.nim @@ -285,6 +285,9 @@ static int __tcc_cas(int *ptr, int oldVal, int newVal) {.importc: "__tcc_cas", nodecl.} proc cas*[T: bool|int|ptr](p: ptr T; oldValue, newValue: T): bool = tcc_cas(cast[ptr int](p), cast[int](oldValue), cast[int](newValue)) +elif declared(atomicCompareExchangeN): + proc cas*[T: bool|int|ptr](p: ptr T; oldValue, newValue: T): bool = + atomicCompareExchangeN(p, oldValue.unsafeAddr, newValue, false, ATOMIC_SEQ_CST, ATOMIC_SEQ_CST) else: # this is valid for GCC and Intel C++ proc cas*[T: bool|int|ptr](p: ptr T; oldValue, newValue: T): bool |