From eab6a4d2d96d11d3926e927c135362fc166895f0 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Wed, 16 May 2018 14:12:29 -0700 Subject: fixes #445 crash in taskq_thread This changes the array of flags, which was confusing, brittle, and racy, into a much simpler reference (busy) count on the task structures. This allows us to support certain kinds of "reentrant" dispatching, where either a synchronous or asynchronous task can reschedule / dispatch itself. The new code also helps reduce certain lock pressure, as a bonus. --- src/core/taskq.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/core/taskq.h') diff --git a/src/core/taskq.h b/src/core/taskq.h index 918c6705..8328e4eb 100644 --- a/src/core/taskq.h +++ b/src/core/taskq.h @@ -31,13 +31,12 @@ extern void nni_task_dispatch(nni_task *); // doubt, use nni_task_dispatch instead.) extern void nni_task_exec(nni_task *); -// nni_task_prep and nni_task_unprep are used by and exclusively for the aio -// framework. nni_task_prep marks the task as "scheduled" without actually +// nni_task_prep is used by and exclusively for the aio framework. +// nni_task_prep marks the task as "scheduled" without actually // dispatching anything to it yet; nni_task_wait will block waiting for the // task to complete normally (after a call to nni_task_dispatch or -// nni_task_exec), or for nni_task_unprep to be called. +// nni_task_exec). extern void nni_task_prep(nni_task *); -extern void nni_task_unprep(nni_task *); extern void nni_task_wait(nni_task *); extern int nni_task_init(nni_task **, nni_taskq *, nni_cb, void *); -- cgit v1.2.3-70-g09d2