From owner-svn-src-all@FreeBSD.ORG Tue Oct 12 18:36:04 2010 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 0CB65106566B; Tue, 12 Oct 2010 18:36:04 +0000 (UTC) (envelope-from mdf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D4C158FC1A; Tue, 12 Oct 2010 18:36:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9CIa3fQ056852; Tue, 12 Oct 2010 18:36:03 GMT (envelope-from mdf@svn.freebsd.org) Received: (from mdf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9CIa356056848; Tue, 12 Oct 2010 18:36:03 GMT (envelope-from mdf@svn.freebsd.org) Message-Id: <201010121836.o9CIa356056848@svn.freebsd.org> From: Matthew D Fleming Date: Tue, 12 Oct 2010 18:36:03 +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: r213739 - in head: share/man/man9 sys/kern sys/sys 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: Tue, 12 Oct 2010 18:36:04 -0000 Author: mdf Date: Tue Oct 12 18:36:03 2010 New Revision: 213739 URL: http://svn.freebsd.org/changeset/base/213739 Log: Re-expose and briefly document taskqueue_run(9). The function is used in at least one 3rd party driver. Requested by: jhb Modified: head/share/man/man9/taskqueue.9 head/sys/kern/subr_taskqueue.c head/sys/sys/taskqueue.h Modified: head/share/man/man9/taskqueue.9 ============================================================================== --- head/share/man/man9/taskqueue.9 Tue Oct 12 18:20:38 2010 (r213738) +++ head/share/man/man9/taskqueue.9 Tue Oct 12 18:36:03 2010 (r213739) @@ -67,6 +67,8 @@ struct task { .Fn taskqueue_drain "struct taskqueue *queue" "struct task *task" .Ft int .Fn taskqueue_member "struct taskqueue *queue" "struct thread *td" +.Ft void +.Fn taskqueue_run "struct taskqueue *queue" "struct task **tpp" .Fn TASK_INIT "struct task *task" "int priority" "task_fn_t *func" "void *context" .Fn TASKQUEUE_DECLARE "name" .Fn TASKQUEUE_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void *context" "init" @@ -178,6 +180,19 @@ and .No 0 otherwise. .Pp +The +.Fn taskqueue_run +function will run all pending tasks in the specified +.Fa queue . +Normally this function is only used internally. +The +.Fa tpp +argument is a pointer to a +.Vt struct task * +that is used to record the currently running task. +The lifetime of this pointer must match that of the +.Fa queue . +.Pp A convenience macro, .Fn TASK_INIT "task" "priority" "func" "context" is provided to initialise a Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Tue Oct 12 18:20:38 2010 (r213738) +++ head/sys/kern/subr_taskqueue.c Tue Oct 12 18:36:03 2010 (r213739) @@ -63,8 +63,6 @@ struct taskqueue { #define TQ_FLAGS_BLOCKED (1 << 1) #define TQ_FLAGS_PENDING (1 << 2) -static void taskqueue_run(struct taskqueue *, struct task **); - static __inline void TQ_LOCK(struct taskqueue *tq) { @@ -216,7 +214,7 @@ taskqueue_unblock(struct taskqueue *queu TQ_UNLOCK(queue); } -static void +void taskqueue_run(struct taskqueue *queue, struct task **tpp) { struct task *task; Modified: head/sys/sys/taskqueue.h ============================================================================== --- head/sys/sys/taskqueue.h Tue Oct 12 18:20:38 2010 (r213738) +++ head/sys/sys/taskqueue.h Tue Oct 12 18:36:03 2010 (r213739) @@ -56,6 +56,7 @@ int taskqueue_start_threads(struct taskq int taskqueue_enqueue(struct taskqueue *queue, struct task *task); void taskqueue_drain(struct taskqueue *queue, struct task *task); void taskqueue_free(struct taskqueue *queue); +void taskqueue_run(struct taskqueue *queue, struct task **tpp); void taskqueue_block(struct taskqueue *queue); void taskqueue_unblock(struct taskqueue *queue); int taskqueue_member(struct taskqueue *queue, struct thread *td);