mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-16 06:52:27 +00:00
Simplify taskqueue_drain() by using proved macros.
This commit is contained in:
parent
d3c351c50f
commit
3d336cd03b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=211284
|
@ -248,23 +248,16 @@ taskqueue_run(struct taskqueue *queue, struct task **tpp)
|
|||
void
|
||||
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->ta_running != NULL && task == *task->ta_running)) {
|
||||
msleep_spin(task, &queue->tq_mutex, "-", 0);
|
||||
}
|
||||
mtx_unlock_spin(&queue->tq_mutex);
|
||||
} else {
|
||||
|
||||
if (!queue->tq_spin)
|
||||
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__);
|
||||
|
||||
mtx_lock(&queue->tq_mutex);
|
||||
while (task->ta_pending != 0 ||
|
||||
(task->ta_running != NULL && task == *task->ta_running)) {
|
||||
msleep(task, &queue->tq_mutex, PWAIT, "-", 0);
|
||||
}
|
||||
mtx_unlock(&queue->tq_mutex);
|
||||
TQ_LOCK(queue);
|
||||
while (task->ta_pending != 0 ||
|
||||
(task->ta_running != NULL && task == *task->ta_running)) {
|
||||
TQ_SLEEP(queue, task, &queue->tq_mutex, PWAIT, "-", 0);
|
||||
}
|
||||
TQ_UNLOCK(queue);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue