Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Feb 2009 01:16:51 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r188548 - head/sys/kern
Message-ID:  <200902130116.n1D1Gpwq072146@svn.freebsd.org>

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



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