aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorMatthew D Fleming <mdf@FreeBSD.org>2010-07-22 16:41:09 +0000
committerMatthew D Fleming <mdf@FreeBSD.org>2010-07-22 16:41:09 +0000
commit242ed5d96c2f8f190e7eee13cb5f22ec85535344 (patch)
tree3a37e0a8990ba91718b1b54ff6cb60d91c9caa49 /sys/sys
parent74d53216ac1236f7171b53ec6cf719621aa0b056 (diff)
downloadsrc-242ed5d96c2f8f190e7eee13cb5f22ec85535344.tar.gz
src-242ed5d96c2f8f190e7eee13cb5f22ec85535344.zip
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)
Notes
Notes: svn path=/head/; revision=210377
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/_task.h15
-rw-r--r--sys/sys/taskqueue.h2
2 files changed, 11 insertions, 6 deletions
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)
/*