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
This commit is contained in:
Andrew Thompson 2009-02-13 01:16:51 +00:00
parent 86c2bc49cc
commit 24ef070126

View File

@ -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--;