From 4b75793ad60a228db727f76caa10615e4a14899b Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 12 Jul 2018 17:41:33 -0700 Subject: fixes #589 tsan found races --- src/core/taskq.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/core/taskq.c') 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); -- cgit v1.2.3-70-g09d2