diff options
author | mckusick <mckusick@FreeBSD.org> | 2010-05-06 17:37:23 +0000 |
---|---|---|
committer | mckusick <mckusick@FreeBSD.org> | 2010-05-06 17:37:23 +0000 |
commit | b25e55dcc52d6203a9ae995ca470a66b6483f71d (patch) | |
tree | 781f2c991a11a3806fdb0891b7a615cb77ebe3ab /sys/kern/subr_taskqueue.c | |
parent | 3a0f5972a0de87aebef1af257922515700da4217 (diff) | |
parent | f3856c6cf2fb115757967b7e32bdeb21bd27d1ee (diff) | |
download | FreeBSD-src-b25e55dcc52d6203a9ae995ca470a66b6483f71d.zip FreeBSD-src-b25e55dcc52d6203a9ae995ca470a66b6483f71d.tar.gz |
Final update to current version of head in preparation for reintegration.
Diffstat (limited to 'sys/kern/subr_taskqueue.c')
-rw-r--r-- | sys/kern/subr_taskqueue.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/subr_taskqueue.c b/sys/kern/subr_taskqueue.c index 8405b3d..3b18269 100644 --- a/sys/kern/subr_taskqueue.c +++ b/sys/kern/subr_taskqueue.c @@ -51,7 +51,6 @@ struct taskqueue { const char *tq_name; taskqueue_enqueue_fn tq_enqueue; void *tq_context; - struct task *tq_running; struct mtx tq_mutex; struct thread **tq_threads; int tq_tcount; @@ -233,13 +232,13 @@ taskqueue_run(struct taskqueue *queue) STAILQ_REMOVE_HEAD(&queue->tq_queue, ta_link); pending = task->ta_pending; task->ta_pending = 0; - queue->tq_running = task; + task->ta_flags |= TA_FLAGS_RUNNING; TQ_UNLOCK(queue); task->ta_func(task->ta_context, pending); TQ_LOCK(queue); - queue->tq_running = NULL; + task->ta_flags &= ~TA_FLAGS_RUNNING; wakeup(task); } @@ -256,14 +255,16 @@ taskqueue_drain(struct taskqueue *queue, struct task *task) { if (queue->tq_spin) { /* XXX */ mtx_lock_spin(&queue->tq_mutex); - while (task->ta_pending != 0 || task == queue->tq_running) + while (task->ta_pending != 0 || + (task->ta_flags & TA_FLAGS_RUNNING) != 0) msleep_spin(task, &queue->tq_mutex, "-", 0); mtx_unlock_spin(&queue->tq_mutex); } else { WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); mtx_lock(&queue->tq_mutex); - while (task->ta_pending != 0 || task == queue->tq_running) + while (task->ta_pending != 0 || + (task->ta_flags & TA_FLAGS_RUNNING) != 0) msleep(task, &queue->tq_mutex, PWAIT, "-", 0); mtx_unlock(&queue->tq_mutex); } |