Date: Tue, 12 Oct 2010 18:36:03 +0000 (UTC) From: Matthew D Fleming <mdf@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r213739 - in head: share/man/man9 sys/kern sys/sys Message-ID: <201010121836.o9CIa356056848@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010121836.o9CIa356056848>