svn commit: r189658 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern

Andrew Thompson thompsa at FreeBSD.org
Tue Mar 10 17:58:23 PDT 2009


Author: thompsa
Date: Wed Mar 11 00:58:22 2009
New Revision: 189658
URL: http://svn.freebsd.org/changeset/base/189658

Log:
  MFC r188548
  
   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.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/kern/subr_taskqueue.c

Modified: stable/7/sys/kern/subr_taskqueue.c
==============================================================================
--- stable/7/sys/kern/subr_taskqueue.c	Wed Mar 11 00:29:22 2009	(r189657)
+++ stable/7/sys/kern/subr_taskqueue.c	Wed Mar 11 00:58:22 2009	(r189658)
@@ -397,10 +397,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_pcount--;


More information about the svn-src-all mailing list