svn commit: r196293 - head/sys/kern

Pawel Jakub Dawidek pjd at FreeBSD.org
Mon Aug 17 08:42:34 UTC 2009


Author: pjd
Date: Mon Aug 17 08:42:34 2009
New Revision: 196293
URL: http://svn.freebsd.org/changeset/base/196293

Log:
  Because taskqueue_run() can drop tq_mutex, we need to check if the
  TQ_FLAGS_ACTIVE flag wasn't removed in the meantime, which means we missed a
  wakeup.
  
  Approved by:	re (kib)

Modified:
  head/sys/kern/subr_taskqueue.c

Modified: head/sys/kern/subr_taskqueue.c
==============================================================================
--- head/sys/kern/subr_taskqueue.c	Mon Aug 17 08:38:41 2009	(r196292)
+++ head/sys/kern/subr_taskqueue.c	Mon Aug 17 08:42:34 2009	(r196293)
@@ -401,6 +401,13 @@ taskqueue_thread_loop(void *arg)
 	TQ_LOCK(tq);
 	while ((tq->tq_flags & TQ_FLAGS_ACTIVE) != 0) {
 		taskqueue_run(tq);
+		/*
+		 * Because taskqueue_run() can drop tq_mutex, we need to
+		 * check if the TQ_FLAGS_ACTIVE flag wasn't removed in the
+		 * meantime, which means we missed a wakeup.
+		 */
+		if ((tq->tq_flags & TQ_FLAGS_ACTIVE) == 0)
+			break;
 		TQ_SLEEP(tq, tq, &tq->tq_mutex, 0, "-", 0);
 	}
 


More information about the svn-src-head mailing list