diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-11-29 00:58:33 -0500 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-07 14:51:36 -0800 |
| commit | f8a314ea075745c244172173391e44c146837b87 (patch) | |
| tree | 902360ac40d421798190804d2baa5dfe9cad31f6 /src/platform/windows | |
| parent | 3dfa962c0d43a59d74c7798c65505082a5c69484 (diff) | |
| download | nng-f8a314ea075745c244172173391e44c146837b87.tar.gz nng-f8a314ea075745c244172173391e44c146837b87.tar.bz2 nng-f8a314ea075745c244172173391e44c146837b87.zip | |
performance: reference counters can use relaxed order when incrementing
Diffstat (limited to 'src/platform/windows')
| -rw-r--r-- | src/platform/windows/win_thread.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/platform/windows/win_thread.c b/src/platform/windows/win_thread.c index a6416cd8..9e74056d 100644 --- a/src/platform/windows/win_thread.c +++ b/src/platform/windows/win_thread.c @@ -1,5 +1,5 @@ // -// Copyright 2021 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -22,6 +22,8 @@ static pfnSetThreadDescription set_thread_desc; // mingw does not define InterlockedAddNoFence64, use the mingw equivalent #if defined(__MINGW32__) || defined(__MINGW64__) #define InterlockedAddNoFence(a, b) __atomic_add_fetch(a, b, __ATOMIC_RELAXED) +#define InterlockedIncrementNoFence(a) \ + __atomic_add_fetch(a, 1, __ATOMIC_RELAXED) #define InterlockedAddNoFence64(a, b) \ __atomic_add_fetch(a, b, __ATOMIC_RELAXED) #define InterlockedIncrementAcquire64(a) \ @@ -326,7 +328,7 @@ nni_atomic_init(nni_atomic_int *v) void nni_atomic_inc(nni_atomic_int *v) { - (void) InterlockedIncrementAcquire(&v->v); + (void) InterlockedIncrementNoFence(&v->v); } int |
