diff options
author | pjd <pjd@FreeBSD.org> | 2009-08-17 08:42:34 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2009-08-17 08:42:34 +0000 |
commit | 3220ee349be0d1b1fa8d9f4a19b5a763a25f069f (patch) | |
tree | 210ac1864bd7a6addbbc1a12c6a4ed4cdcb3f2cb /sys/kern/subr_taskqueue.c | |
parent | ecef618a3741ef25f71cc6f035412f57986febec (diff) | |
download | FreeBSD-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/subr_taskqueue.c')
-rw-r--r-- | sys/kern/subr_taskqueue.c | 7 |
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); } |