1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-17 22:24:49 +00:00

Be a bit safer with reference counting.

We might want to revisit some uses of refcounts in the
ev module to be more efficient if we care about signal atomicity
(where memory order isn't really important) or multithreading atomicity.
This commit is contained in:
Calvin Rose 2023-10-21 09:43:28 -05:00
parent 46b34833c2
commit e74365fe38

View File

@ -505,7 +505,7 @@ JanetAtomicInt janet_atomic_dec(JanetAtomicInt volatile *x) {
#ifdef JANET_WINDOWS
return InterlockedDecrement(x);
#else
return __atomic_add_fetch(x, -1, __ATOMIC_RELAXED);
return __atomic_add_fetch(x, -1, __ATOMIC_ACQ_REL);
#endif
}