Don't wait on workqueue_wait if called from worker itself
Otherwise workqueue_wait never return in such a case. This treatment is the same as callout_halt.
This commit is contained in:
parent
93c55cb558
commit
21f6c0a11a
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr_workqueue.c,v 1.36 2018/02/06 03:48:39 ozaki-r Exp $ */
|
||||
/* $NetBSD: subr_workqueue.c,v 1.37 2018/06/13 05:26:12 ozaki-r Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)2002, 2005, 2006, 2007 YAMAMOTO Takashi,
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_workqueue.c,v 1.36 2018/02/06 03:48:39 ozaki-r Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_workqueue.c,v 1.37 2018/06/13 05:26:12 ozaki-r Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/cpu.h>
|
||||
@ -287,6 +287,8 @@ workqueue_q_wait(struct workqueue_queue *q, work_impl_t *wk_target)
|
||||
bool found = false;
|
||||
|
||||
mutex_enter(&q->q_mutex);
|
||||
if (q->q_worker == curlwp)
|
||||
goto out;
|
||||
again:
|
||||
SIMPLEQ_FOREACH(wk, &q->q_queue_pending, wk_entry) {
|
||||
if (wk == wk_target)
|
||||
@ -306,6 +308,7 @@ workqueue_q_wait(struct workqueue_queue *q, work_impl_t *wk_target)
|
||||
}
|
||||
if (q->q_waiter != NULL)
|
||||
q->q_waiter = NULL;
|
||||
out:
|
||||
mutex_exit(&q->q_mutex);
|
||||
|
||||
return found;
|
||||
|
Loading…
Reference in New Issue
Block a user