From owner-svn-src-all@FreeBSD.ORG Fri Feb 13 01:16:51 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBE11106567F; Fri, 13 Feb 2009 01:16:51 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA7A68FC15; Fri, 13 Feb 2009 01:16:51 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1D1Gpq8072147; Fri, 13 Feb 2009 01:16:51 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1D1Gpwq072146; Fri, 13 Feb 2009 01:16:51 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200902130116.n1D1Gpwq072146@svn.freebsd.org> From: Andrew Thompson Date: Fri, 13 Feb 2009 01:16:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188548 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Feb 2009 01:16:52 -0000 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--;