From owner-svn-src-user@FreeBSD.ORG Wed Oct 19 12:16:20 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59D791065674; Wed, 19 Oct 2011 12:16:20 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49FB58FC27; Wed, 19 Oct 2011 12:16:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9JCGKsp024426; Wed, 19 Oct 2011 12:16:20 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9JCGKcr024423; Wed, 19 Oct 2011 12:16:20 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201110191216.p9JCGKcr024423@svn.freebsd.org> From: Adrian Chadd Date: Wed, 19 Oct 2011 12:16:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226542 - in user/adrian/if_ath_tx/sys: kern sys X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Oct 2011 12:16:20 -0000 Author: adrian Date: Wed Oct 19 12:16:19 2011 New Revision: 226542 URL: http://svn.freebsd.org/changeset/base/226542 Log: Begin fleshing out a way to wait for all pending taskqueue entries to complete. The current API only lets you wait for a given taskqueue task, rather than all of them. This isn't (yet) tested. Modified: user/adrian/if_ath_tx/sys/kern/subr_taskqueue.c user/adrian/if_ath_tx/sys/sys/taskqueue.h Modified: user/adrian/if_ath_tx/sys/kern/subr_taskqueue.c ============================================================================== --- user/adrian/if_ath_tx/sys/kern/subr_taskqueue.c Wed Oct 19 12:15:16 2011 (r226541) +++ user/adrian/if_ath_tx/sys/kern/subr_taskqueue.c Wed Oct 19 12:16:19 2011 (r226542) @@ -397,6 +397,22 @@ taskqueue_drain(struct taskqueue *queue, TQ_UNLOCK(queue); } +/* + * XXX this is currently completely and utterly undocumented. + */ +void +taskqueue_drain_all(struct taskqueue *queue) +{ + + if (!queue->tq_spin) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); + + TQ_LOCK(queue); + while (! STAILQ_EMPTY(&queue->tq_queue)) + TQ_SLEEP(queue, queue, &queue->tq_mutex, PWAIT, "-", 0); + TQ_UNLOCK(queue); +} + void taskqueue_drain_timeout(struct taskqueue *queue, struct timeout_task *timeout_task) Modified: user/adrian/if_ath_tx/sys/sys/taskqueue.h ============================================================================== --- user/adrian/if_ath_tx/sys/sys/taskqueue.h Wed Oct 19 12:15:16 2011 (r226541) +++ user/adrian/if_ath_tx/sys/sys/taskqueue.h Wed Oct 19 12:16:19 2011 (r226542) @@ -69,6 +69,7 @@ int taskqueue_cancel(struct taskqueue *q int taskqueue_cancel_timeout(struct taskqueue *queue, struct timeout_task *timeout_task, u_int *pendp); void taskqueue_drain(struct taskqueue *queue, struct task *task); +void taskqueue_drain_all(struct taskqueue *queue); void taskqueue_drain_timeout(struct taskqueue *queue, struct timeout_task *timeout_task); void taskqueue_free(struct taskqueue *queue);