aboutsummaryrefslogtreecommitdiff
path: root/src/sp
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2025-01-05 09:46:16 -0800
committerGarrett D'Amore <garrett@damore.org>2025-01-05 09:49:56 -0800
commite5d5b625f16c3c3df5a3fdcc114a6694d82ab6e8 (patch)
tree8cf3f1ede137ac8c08c002700a297fe0d6972fd3 /src/sp
parentcf7dda752e1a49cb1003b0e300a5200ff0b0c92e (diff)
downloadnng-e5d5b625f16c3c3df5a3fdcc114a6694d82ab6e8.tar.gz
nng-e5d5b625f16c3c3df5a3fdcc114a6694d82ab6e8.tar.bz2
nng-e5d5b625f16c3c3df5a3fdcc114a6694d82ab6e8.zip
platform: remove reader/writer locks
The only thing using this was the transport lookups, but as those transports are now fully initialized in nng_init, we no longer need to lock that at all.
Diffstat (limited to 'src/sp')
-rw-r--r--src/sp/transport.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/sp/transport.c b/src/sp/transport.c
index 1082db5b..e1c2737e 100644
--- a/src/sp/transport.c
+++ b/src/sp/transport.c
@@ -1,5 +1,5 @@
//
-// Copyright 2024 Staysail Systems, Inc. <info@staysail.tech>
+// Copyright 2025 Staysail Systems, Inc. <info@staysail.tech>
// Copyright 2018 Capitar IT Group BV <info@capitar.com>
// Copyright 2019 Devolutions <info@devolutions.net>
//
@@ -16,7 +16,6 @@
static nni_list sp_tran_list =
NNI_LIST_INITIALIZER(sp_tran_list, nni_sp_tran, tran_link);
-static nni_rwlock sp_tran_lk = NNI_RWLOCK_INITIALIZER;
void
nni_sp_tran_register(nni_sp_tran *tran)
@@ -55,14 +54,12 @@ nni_sp_tran_register(nni_sp_tran *tran)
}
#endif
- nni_rwlock_wrlock(&sp_tran_lk);
if (!nni_list_node_active(&tran->tran_link)) {
tran->tran_init();
nni_list_append(&sp_tran_list, tran);
nng_log_info(
"NNG-TRAN", "Registered transport: %s", tran->tran_scheme);
}
- nni_rwlock_unlock(&sp_tran_lk);
}
nni_sp_tran *
@@ -71,16 +68,13 @@ nni_sp_tran_find(const char *url)
// address is of the form "<scheme>://blah..."
nni_sp_tran *t;
- nni_rwlock_rdlock(&sp_tran_lk);
NNI_LIST_FOREACH (&sp_tran_list, t) {
size_t len = strlen(t->tran_scheme);
if ((strncmp(url, t->tran_scheme, len) == 0) &&
(url[len] == ':' || url[len] == '\0')) {
- nni_rwlock_unlock(&sp_tran_lk);
return (t);
}
}
- nni_rwlock_unlock(&sp_tran_lk);
return (NULL);
}