diff options
| author | Edward Rudd <urkle@outoforder.cc> | 2021-12-08 16:30:46 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-08 16:30:46 -0500 |
| commit | 317fdb2ff02c98d88a3950791e938b1db3cca1cd (patch) | |
| tree | 7fc9cbce528276f577feab85c6de0b111d0560e3 | |
| parent | 2884fb552c9fb347a4dbca21d1b641c447f4aeee (diff) | |
| download | nng-317fdb2ff02c98d88a3950791e938b1db3cca1cd.tar.gz nng-317fdb2ff02c98d88a3950791e938b1db3cca1cd.tar.bz2 nng-317fdb2ff02c98d88a3950791e938b1db3cca1cd.zip | |
Fixes compiling on windows 32-bit (#1549)
* use correct LONG type for nni_atomic_flag on win32
* use InterlockExchangeAdd for nni_atomic_get_bool
- this is equivelent to InterlockAdd for the purposes of this call (since it is adding 0)
- this allows the code to compile on 32bit windows
| -rw-r--r-- | src/platform/windows/win_impl.h | 2 | ||||
| -rw-r--r-- | src/platform/windows/win_thread.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/platform/windows/win_impl.h b/src/platform/windows/win_impl.h index bbd007d0..c5be56fa 100644 --- a/src/platform/windows/win_impl.h +++ b/src/platform/windows/win_impl.h @@ -56,7 +56,7 @@ struct nni_plat_cv { #define NNI_CV_INITIALIZER(mxp) { .srl = mxp, .cv = CONDITION_VARIABLE_INIT } struct nni_atomic_flag { - unsigned f; + LONG f; }; struct nni_atomic_bool { diff --git a/src/platform/windows/win_thread.c b/src/platform/windows/win_thread.c index b131c067..f9376c40 100644 --- a/src/platform/windows/win_thread.c +++ b/src/platform/windows/win_thread.c @@ -180,7 +180,7 @@ nni_atomic_set_bool(nni_atomic_bool *v, bool b) bool nni_atomic_get_bool(nni_atomic_bool *v) { - return ((bool) InterlockedAdd(&v->v, 0)); + return ((bool) InterlockedExchangeAdd(&v->v, 0)); } bool |
