From 242ed5d96c2f8f190e7eee13cb5f22ec85535344 Mon Sep 17 00:00:00 2001 From: Matthew D Fleming Date: Thu, 22 Jul 2010 16:41:09 +0000 Subject: Fix taskqueue_drain(9) to not have false negatives. For threaded taskqueues, more than one task can be running simultaneously. Also make taskqueue_run(9) static to the file, since there are no consumers in the base kernel and the function signature needs to change with this fix. Remove mention of taskqueue_run(9) and taskqueue_run_fast(9) from the taskqueue(9) man page. Reviewed by: jhb Approved by: zml (mentor) --- sys/sys/_task.h | 15 ++++++++++----- sys/sys/taskqueue.h | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'sys/sys') diff --git a/sys/sys/_task.h b/sys/sys/_task.h index 2a51e1b07b97..c3f94323ebd2 100644 --- a/sys/sys/_task.h +++ b/sys/sys/_task.h @@ -36,15 +36,20 @@ * taskqueue_run(). The first argument is taken from the 'ta_context' * field of struct task and the second argument is a count of how many * times the task was enqueued before the call to taskqueue_run(). + * + * List of locks + * (c) const after init + * (q) taskqueue lock */ typedef void task_fn_t(void *context, int pending); struct task { - STAILQ_ENTRY(task) ta_link; /* link for queue */ - u_short ta_pending; /* count times queued */ - u_short ta_priority; /* Priority */ - task_fn_t *ta_func; /* task handler */ - void *ta_context; /* argument for handler */ + struct task **ta_running; /* (q) queue's running task pointer */ + STAILQ_ENTRY(task) ta_link; /* (q) link for queue */ + u_short ta_pending; /* (q) count times queued */ + u_short ta_priority; /* (c) Priority */ + task_fn_t *ta_func; /* (c) task handler */ + void *ta_context; /* (c) argument for handler */ }; #endif /* !_SYS__TASK_H_ */ diff --git a/sys/sys/taskqueue.h b/sys/sys/taskqueue.h index bf2e4ee31d0d..2490deb3c0f7 100644 --- a/sys/sys/taskqueue.h +++ b/sys/sys/taskqueue.h @@ -56,7 +56,6 @@ int taskqueue_start_threads(struct taskqueue **tqp, int count, int pri, int taskqueue_enqueue(struct taskqueue *queue, struct task *task); void taskqueue_drain(struct taskqueue *queue, struct task *task); void taskqueue_free(struct taskqueue *queue); -void taskqueue_run(struct taskqueue *queue); void taskqueue_block(struct taskqueue *queue); void taskqueue_unblock(struct taskqueue *queue); int taskqueue_member(struct taskqueue *queue, struct thread *td); @@ -75,6 +74,7 @@ void taskqueue_thread_enqueue(void *context); (task)->ta_priority = (priority); \ (task)->ta_func = (func); \ (task)->ta_context = (context); \ + (task)->ta_running = NULL; \ } while (0) /* -- cgit v1.2.3