svn commit: r211284 - head/sys/kern
mdf at FreeBSD.org
mdf at FreeBSD.org
Fri Aug 13 19:47:13 UTC 2010
On Fri, Aug 13, 2010 at 12:20 PM, Pawel Jakub Dawidek <pjd at freebsd.org> wrote:
> Author: pjd
> Date: Fri Aug 13 19:20:35 2010
> New Revision: 211284
> URL: http://svn.freebsd.org/changeset/base/211284
>
> Log:
> Simplify taskqueue_drain() by using proved macros.
Thanks! This was on my to-do list since I'd been in this file, once I
could figure out why it hand't already been done. :-)
Cheers,
matthew
>
> Modified:
> head/sys/kern/subr_taskqueue.c
>
> Modified: head/sys/kern/subr_taskqueue.c
> ==============================================================================
> --- head/sys/kern/subr_taskqueue.c Fri Aug 13 18:17:32 2010 (r211283)
> +++ head/sys/kern/subr_taskqueue.c Fri Aug 13 19:20:35 2010 (r211284)
> @@ -248,23 +248,16 @@ taskqueue_run(struct taskqueue *queue, s
> 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
>
More information about the svn-src-head
mailing list