aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/http
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2024-11-29 00:58:33 -0500
committerGarrett D'Amore <garrett@damore.org>2024-12-07 14:51:36 -0800
commitf8a314ea075745c244172173391e44c146837b87 (patch)
tree902360ac40d421798190804d2baa5dfe9cad31f6 /src/supplemental/http
parent3dfa962c0d43a59d74c7798c65505082a5c69484 (diff)
downloadnng-f8a314ea075745c244172173391e44c146837b87.tar.gz
nng-f8a314ea075745c244172173391e44c146837b87.tar.bz2
nng-f8a314ea075745c244172173391e44c146837b87.zip
performance: reference counters can use relaxed order when incrementing
Diffstat (limited to 'src/supplemental/http')
-rw-r--r--src/supplemental/http/http_server.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/supplemental/http/http_server.c b/src/supplemental/http/http_server.c
index 49203a1c..2240492f 100644
--- a/src/supplemental/http/http_server.c
+++ b/src/supplemental/http/http_server.c
@@ -31,7 +31,7 @@ struct nng_http_handler {
bool host_ip;
bool tree;
bool tree_exclusive;
- nni_atomic_u64 ref;
+ nni_atomic_int ref;
nni_atomic_bool busy;
size_t maxbody;
bool getbody;
@@ -107,8 +107,8 @@ nni_http_handler_init(
if ((h = NNI_ALLOC_STRUCT(h)) == NULL) {
return (NNG_ENOMEM);
}
- nni_atomic_init64(&h->ref);
- nni_atomic_inc64(&h->ref);
+ nni_atomic_init(&h->ref);
+ nni_atomic_inc(&h->ref);
// Default for HTTP is /. But remap it to "" for ease of matching.
if ((uri == NULL) || (strlen(uri) == 0) || (strcmp(uri, "/") == 0)) {
@@ -137,7 +137,7 @@ nni_http_handler_init(
void
nni_http_handler_fini(nni_http_handler *h)
{
- if (nni_atomic_dec64_nv(&h->ref) != 0) {
+ if (nni_atomic_dec_nv(&h->ref) != 0) {
return;
}
if (h->dtor != NULL) {
@@ -735,7 +735,7 @@ finish:
// Set a reference -- this because the callback may be running
// asynchronously even after it gets removed from the server.
- nni_atomic_inc64(&h->ref);
+ nni_atomic_inc(&h->ref);
// Documented that we call this on behalf of the callback.
if (nni_aio_begin(sc->cbaio) != 0) {