-
-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
performance: reference counters can use relaxed order when incrementing
- Loading branch information
Showing
8 changed files
with
35 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// | ||
// Copyright 2023 Staysail Systems, Inc. <[email protected]> | ||
// Copyright 2024 Staysail Systems, Inc. <[email protected]> | ||
// Copyright 2018 Capitar IT Group BV <[email protected]> | ||
// Copyright 2019 Devolutions <[email protected]> | ||
// | ||
|
@@ -69,7 +69,7 @@ ipc_dialer_free(void *arg) | |
void | ||
nni_posix_ipc_dialer_rele(ipc_dialer *d) | ||
{ | ||
if (((nni_atomic_dec64_nv(&d->ref)) != 0) || | ||
if (((nni_atomic_dec_nv(&d->ref)) != 0) || | ||
(!nni_atomic_get_bool(&d->fini))) { | ||
return; | ||
} | ||
|
@@ -176,7 +176,7 @@ ipc_dialer_dial(void *arg, nni_aio *aio) | |
return; | ||
} | ||
|
||
nni_atomic_inc64(&d->ref); | ||
nni_atomic_inc(&d->ref); | ||
|
||
if ((rv = nni_posix_ipc_alloc(&c, &d->sa, d)) != 0) { | ||
(void) close(fd); | ||
|
@@ -323,8 +323,8 @@ nni_ipc_dialer_alloc(nng_stream_dialer **dp, const nng_url *url) | |
d->sd.sd_get = ipc_dialer_get; | ||
d->sd.sd_set = ipc_dialer_set; | ||
nni_atomic_init_bool(&d->fini); | ||
nni_atomic_init64(&d->ref); | ||
nni_atomic_inc64(&d->ref); | ||
nni_atomic_init(&d->ref); | ||
nni_atomic_inc(&d->ref); | ||
|
||
*dp = (void *) d; | ||
return (0); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// | ||
// Copyright 2021 Staysail Systems, Inc. <[email protected]> | ||
// Copyright 2024 Staysail Systems, Inc. <[email protected]> | ||
// Copyright 2018 Capitar IT Group BV <[email protected]> | ||
// | ||
// 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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters