diff options
| -rw-r--r-- | src/core/socket.c | 3 | ||||
| -rw-r--r-- | src/core/taskq.c | 3 |
2 files changed, 5 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); diff --git a/src/core/taskq.c b/src/core/taskq.c index 82a7456b..9dde6981 100644 --- a/src/core/taskq.c +++ b/src/core/taskq.c @@ -51,8 +51,11 @@ nni_taskq_thread(void *self) if ((task = nni_list_first(&tq->tq_tasks)) != NULL) { bool reap; + nni_mtx_lock(&task->task_mtx); nni_list_remove(&tq->tq_tasks, task); task->task_thr = &thr->tqt_thread; + nni_mtx_unlock(&task->task_mtx); + nni_mtx_unlock(&tq->tq_mtx); task->task_cb(task->task_arg); |
