summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-02-13 01:16:51 +0000
committerthompsa <thompsa@FreeBSD.org>2009-02-13 01:16:51 +0000
commit618fc50d6bd7c81079f286902150004255af6323 (patch)
tree559b54bed49d2e4dddc41ccbc5aeb73318d94a58 /sys
parent4db9ef7c9b699580a211b68491f2b0b7b7d43e3f (diff)
downloadFreeBSD-src-618fc50d6bd7c81079f286902150004255af6323.zip
FreeBSD-src-618fc50d6bd7c81079f286902150004255af6323.tar.gz
Check the exit flag at the start of the taskqueue loop rather than the end. It
is possible to tear down the taskqueue before the thread has run and the taskqueue loop would sleep forever. Reviewed by: sam MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_taskqueue.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/subr_taskqueue.c b/sys/kern/subr_taskqueue.c
index 9059a15..bdb97f3 100644
--- a/sys/kern/subr_taskqueue.c
+++ b/sys/kern/subr_taskqueue.c
@@ -399,10 +399,10 @@ taskqueue_thread_loop(void *arg)
tqp = arg;
tq = *tqp;
TQ_LOCK(tq);
- do {
+ while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) {
taskqueue_run(tq);
TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0);
- } while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0);
+ };
/* rendezvous with thread that asked us to terminate */
tq->tq_tcount--;
OpenPOWER on IntegriCloud