Skip to content

Commit

Permalink
fixes Undefined reference to nni_atomic_dec & nni_atomic_dec64 on Win…
Browse files Browse the repository at this point in the history
…dows. (nanomsg#1591)
  • Loading branch information
alvin1221 committed May 30, 2022
1 parent c6d2d1f commit 5f6127f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/platform/windows/win_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 5f6127f

Please sign in to comment.