summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <0x7fffff@guattari.ru>2022-08-15 02:25:43 +0400
committerMitya Selivanov <0x7fffff@guattari.ru>2022-08-15 02:25:43 +0400
commitb0811b24d400aaab3629440c0da9fd792b22f55b (patch)
treef8da11433a6a8f9c1d9a6db02e591e7e704c691c
parente475b4657527f8de436f11381b3d331bf7116d15 (diff)
downloadkit-b0811b24d400aaab3629440c0da9fd792b22f55b.zip
[atomic] memory_order for load on Windows
-rw-r--r--source/kit/atomic.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/kit/atomic.c b/source/kit/atomic.c
index 33d355a..fc5b53d 100644
--- a/source/kit/atomic.c
+++ b/source/kit/atomic.c
@@ -25,7 +25,9 @@ void kit_atomic_store_explicit(volatile KIT_ATOMIC_VAR *var,
KIT_ATOMIC_VAR kit_atomic_load_explicit(volatile KIT_ATOMIC_VAR *var,
int memory_order) {
- return *var;
+ if (memory_order == memory_order_relaxed)
+ return *var;
+ return InterlockedExchangeAdd_(var, 0);
}
KIT_ATOMIC_VAR kit_atomic_fetch_add_explicit(