Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Mar 2009 00:58:22 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r189658 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb kern
Message-ID:  <200903110058.n2B0wMNM078636@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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--;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903110058.n2B0wMNM078636>