diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-07-13 18:58:50 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-07-13 18:58:50 -0700 |
| commit | f902cd65b6dda1fc07efbb7b9aba909a91cf5f10 (patch) | |
| tree | 1dda00a99d0c726151adfbfe9e69782c3c0f54e0 /src/protocol/survey/respond.c | |
| parent | 841048a806f7836bd1196f48c5ee3db5ca844b88 (diff) | |
| download | nng-f902cd65b6dda1fc07efbb7b9aba909a91cf5f10.tar.gz nng-f902cd65b6dda1fc07efbb7b9aba909a91cf5f10.tar.bz2 nng-f902cd65b6dda1fc07efbb7b9aba909a91cf5f10.zip | |
Now that idhash is locked, we can ditch some locking in protocols.
Diffstat (limited to 'src/protocol/survey/respond.c')
| -rw-r--r-- | src/protocol/survey/respond.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/protocol/survey/respond.c b/src/protocol/survey/respond.c index 17018155..c2b8cd18 100644 --- a/src/protocol/survey/respond.c +++ b/src/protocol/survey/respond.c @@ -38,7 +38,6 @@ struct nni_resp_sock { char * btrace; size_t btrace_len; nni_aio aio_getq; - nni_mtx mtx; }; // An nni_resp_pipe is our per-pipe protocol private structure. @@ -64,7 +63,6 @@ nni_resp_sock_fini(void *arg) if (psock->btrace != NULL) { nni_free(psock->btrace, psock->btrace_len); } - nni_mtx_fini(&psock->mtx); NNI_FREE_STRUCT(psock); } } @@ -85,8 +83,7 @@ nni_resp_sock_init(void **pp, nni_sock *nsock) psock->btrace_len = 0; psock->urq = nni_sock_recvq(nsock); psock->uwq = nni_sock_sendq(nsock); - if (((rv = nni_idhash_init(&psock->pipes)) != 0) || - ((rv = nni_mtx_init(&psock->mtx)) != 0)) { + if ((rv = nni_idhash_init(&psock->pipes)) != 0) { goto fail; } rv = nni_aio_init(&psock->aio_getq, nni_resp_sock_getq_cb, psock); @@ -180,9 +177,7 @@ nni_resp_pipe_start(void *arg) ppipe->id = nni_pipe_id(ppipe->npipe); - nni_mtx_lock(&psock->mtx); rv = nni_idhash_insert(psock->pipes, ppipe->id, ppipe); - nni_mtx_unlock(&psock->mtx); if (rv != 0) { return (rv); } @@ -205,12 +200,10 @@ nni_resp_pipe_stop(void *arg) nni_aio_stop(&ppipe->aio_send); nni_aio_stop(&ppipe->aio_recv); - nni_mtx_lock(&psock->mtx); if (ppipe->id != 0) { nni_idhash_remove(psock->pipes, ppipe->id); ppipe->id = 0; } - nni_mtx_unlock(&psock->mtx); } // nni_resp_sock_send watches for messages from the upper write queue, @@ -246,7 +239,6 @@ nni_resp_sock_getq_cb(void *arg) NNI_GET32(header, id); nni_msg_trim_header(msg, 4); - nni_mtx_lock(&psock->mtx); rv = nni_idhash_find(psock->pipes, id, (void **) &ppipe); if (rv != 0) { @@ -258,7 +250,6 @@ nni_resp_sock_getq_cb(void *arg) nni_msg_free(msg); } } - nni_mtx_unlock(&psock->mtx); } void |
