diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-07-12 17:41:33 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-07-16 10:06:55 -0700 |
| commit | 4b75793ad60a228db727f76caa10615e4a14899b (patch) | |
| tree | cb5b6478ce3417d185b1a290b420d716ddfc0293 /src/core/socket.c | |
| parent | b44e20c80c936a29bfeaf964ec94bc62ac0386f5 (diff) | |
| download | nng-4b75793ad60a228db727f76caa10615e4a14899b.tar.gz nng-4b75793ad60a228db727f76caa10615e4a14899b.tar.bz2 nng-4b75793ad60a228db727f76caa10615e4a14899b.zip | |
fixes #589 tsan found races
Diffstat (limited to 'src/core/socket.c')
| -rw-r--r-- | src/core/socket.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index 640e0db6..0ca5e22d 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -1574,15 +1574,16 @@ nni_pipe_run_cb(nni_pipe *p, nng_pipe_ev ev) nng_pipe_cb cb; void * arg; + nni_mtx_lock(&s->s_pipe_cbs_mtx); if (!p->p_cbs) { if (ev == NNG_PIPE_EV_ADD_PRE) { // First event, after this we want all other events. p->p_cbs = true; } else { + nni_mtx_unlock(&s->s_pipe_cbs_mtx); return; } } - nni_mtx_lock(&s->s_pipe_cbs_mtx); cb = s->s_pipe_cbs[ev].cb_fn; arg = s->s_pipe_cbs[ev].cb_arg; nni_mtx_unlock(&s->s_pipe_cbs_mtx); |
