diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-07-02 22:36:08 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-07-03 19:00:19 -0700 |
| commit | d1a9c84a6b375cb25a8b7475957130e364b41753 (patch) | |
| tree | 5444721d96a84d92e3ed258b4d51f80adf6b200c /src/protocol/survey0 | |
| parent | a772bcc6ebe198f939889abbda18eded2a326941 (diff) | |
| download | nng-d1a9c84a6b375cb25a8b7475957130e364b41753.tar.gz nng-d1a9c84a6b375cb25a8b7475957130e364b41753.tar.bz2 nng-d1a9c84a6b375cb25a8b7475957130e364b41753.zip | |
fixes #572 Several locking errors found
fixes #573 atomic flags could help
This introduces a new atomic flag, and reduces some of the global
locking. The lock refactoring work is not yet complete, but this is
a positive step forward, and should help with certain things.
While here we also fixed a compile warning due to incorrect types.
Diffstat (limited to 'src/protocol/survey0')
| -rw-r--r-- | src/protocol/survey0/respond.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/protocol/survey0/respond.c b/src/protocol/survey0/respond.c index db18a4e8..fbdeb65a 100644 --- a/src/protocol/survey0/respond.c +++ b/src/protocol/survey0/respond.c @@ -402,15 +402,14 @@ resp0_pipe_send_cb(void *arg) nni_msg * msg; size_t len; - nni_mtx_lock(&s->mtx); - p->busy = false; if (nni_aio_result(p->aio_send) != 0) { nni_msg_free(nni_aio_get_msg(p->aio_send)); nni_aio_set_msg(p->aio_send, NULL); nni_pipe_stop(p->npipe); - nni_mtx_unlock(&s->mtx); return; } + nni_mtx_lock(&s->mtx); + p->busy = false; if ((ctx = nni_list_first(&p->sendq)) == NULL) { // Nothing else to send. if (p->id == s->ctx->pipe_id) { |
