summaryrefslogtreecommitdiff
path: root/sys/kern/subr_taskqueue.c
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2009-08-17 08:46:47 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2009-08-17 08:46:47 +0000
commitea5f504fed085eba4540b59651fbd57056995284 (patch)
tree07c667cdd32a87a59a9cb9962e612751a08c7ae8 /sys/kern/subr_taskqueue.c
parent4aae820003fab650d8095cfba671ca607e5e19cc (diff)
Notes
Diffstat (limited to 'sys/kern/subr_taskqueue.c')
-rw-r--r--sys/kern/subr_taskqueue.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/kern/subr_taskqueue.c b/sys/kern/subr_taskqueue.c
index bd4f34d9b9bc..e49c8024ecfc 100644
--- a/sys/kern/subr_taskqueue.c
+++ b/sys/kern/subr_taskqueue.c
@@ -401,6 +401,13 @@ taskqueue_thread_loop(void *arg)
TQ_LOCK(tq);
while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) {
taskqueue_run(tq);
+ /*
+ * Because taskqueue_run() can drop tq_mutex, we need to
+ * check if the TQ_FLAGS_ACTIVE flag wasn't removed in the
+ * meantime, which means we missed a wakeup.
+ */
+ if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0)
+ break;
TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0);
}