aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralvin1221 <68314044+alvin1221@users.noreply.github.com>2022-05-30 11:22:07 +0800
committerGitHub <noreply@github.com>2022-05-29 20:22:07 -0700
commit5f6127f69042fbb1f7ec25012c92fe1ebdbcedcb (patch)
treec162c9d1a3b4f33a6b26284c61365cf9f16f98be
parentc6d2d1f474a83fcf3312a17b041db344236fa0fe (diff)
downloadnng-5f6127f69042fbb1f7ec25012c92fe1ebdbcedcb.tar.gz
nng-5f6127f69042fbb1f7ec25012c92fe1ebdbcedcb.tar.bz2
nng-5f6127f69042fbb1f7ec25012c92fe1ebdbcedcb.zip
fixes Undefined reference to nni_atomic_dec & nni_atomic_dec64 on Windows. (#1591)
-rw-r--r--src/platform/windows/win_thread.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/platform/windows/win_thread.c b/src/platform/windows/win_thread.c
index 6463be3c..652a754d 100644
--- a/src/platform/windows/win_thread.c
+++ b/src/platform/windows/win_thread.c
@@ -265,6 +265,16 @@ nni_atomic_dec64_nv(nni_atomic_u64 *v)
#endif
}
+void
+nni_atomic_dec64(nni_atomic_u64 *v)
+{
+#ifdef _WIN64
+ InterlockedDecrementAcquire64(&v->v);
+#else
+ InterlockedDecrement64(&v->v);
+#endif
+}
+
bool
nni_atomic_cas64(nni_atomic_u64 *v, uint64_t comp, uint64_t new)
{
@@ -323,6 +333,12 @@ nni_atomic_dec_nv(nni_atomic_int *v)
return (InterlockedDecrementRelease(&v->v));
}
+void
+nni_atomic_dec(nni_atomic_int *v)
+{
+ (void) InterlockedDecrementAcquire(&v->v);
+}
+
bool
nni_atomic_cas(nni_atomic_int *v, int comp, int new)
{