svn commit: r188548 - head/sys/kern
Andrew Thompson
thompsa at FreeBSD.org
Thu Feb 12 17:16:52 PST 2009
Author: thompsa
Date: Fri Feb 13 01:16:51 2009
New Revision: 188548
URL: http://svn.freebsd.org/changeset/base/188548
Log:
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
Modified:
head/sys/kern/subr_taskqueue.c
Modified: head/sys/kern/subr_taskqueue.c
==============================================================================
--- head/sys/kern/subr_taskqueue.c Fri Feb 13 01:14:00 2009 (r188547)
+++ head/sys/kern/subr_taskqueue.c Fri Feb 13 01:16:51 2009 (r188548)
@@ -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--;
More information about the svn-src-all
mailing list