summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2009-08-17 08:42:34 +0000
committerpjd <pjd@FreeBSD.org>2009-08-17 08:42:34 +0000
commit3220ee349be0d1b1fa8d9f4a19b5a763a25f069f (patch)
tree210ac1864bd7a6addbbc1a12c6a4ed4cdcb3f2cb /sys/kern
parentecef618a3741ef25f71cc6f035412f57986febec (diff)
downloadFreeBSD-src-3220ee349be0d1b1fa8d9f4a19b5a763a25f069f.zip
FreeBSD-src-3220ee349be0d1b1fa8d9f4a19b5a763a25f069f.tar.gz
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. Approved by: re (kib)
Diffstat (limited to 'sys/kern')
-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 bd4f34d..e49c802 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);
}
OpenPOWER on IntegriCloud