Date: Mon, 19 Dec 2011 18:55:13 +0000 (UTC) From: John Baldwin <jhb@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r228715 - in head: share/man/man9 sys/sys Message-ID: <201112191855.pBJItDl0070755@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jhb Date: Mon Dec 19 18:55:13 2011 New Revision: 228715 URL: http://svn.freebsd.org/changeset/base/228715 Log: Add a TASK_INITIALIZER() macro that can be used to statically initialize a task structure. Reviewed by: gj MFC after: 2 weeks Modified: head/share/man/man9/Makefile head/share/man/man9/taskqueue.9 head/sys/sys/taskqueue.h Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Dec 19 18:08:31 2011 (r228714) +++ head/share/man/man9/Makefile Mon Dec 19 18:55:13 2011 (r228715) @@ -1250,6 +1250,7 @@ MLINKS+=sysctl_ctx_init.9 sysctl_ctx_ent sysctl_ctx_init.9 sysctl_ctx_free.9 MLINKS+=SYSINIT.9 SYSUNINIT.9 MLINKS+=taskqueue.9 TASK_INIT.9 \ + taskqueue.9 TASK_INITIALIZER.9 \ taskqueue.9 taskqueue_cancel.9 \ taskqueue.9 taskqueue_create.9 \ taskqueue.9 taskqueue_create_fast.9 \ Modified: head/share/man/man9/taskqueue.9 ============================================================================== --- head/share/man/man9/taskqueue.9 Mon Dec 19 18:08:31 2011 (r228714) +++ head/share/man/man9/taskqueue.9 Mon Dec 19 18:55:13 2011 (r228715) @@ -80,6 +80,7 @@ struct timeout_task; .Ft void .Fn taskqueue_run "struct taskqueue *queue" .Fn TASK_INIT "struct task *task" "int priority" "task_fn_t func" "void *context" +.Fn TASK_INITIALIZER "int priority" "task_fn_t func" "void *context" .Fn TASKQUEUE_DECLARE "name" .Fn TASKQUEUE_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void *context" "init" .Fn TASKQUEUE_FAST_DEFINE "name" "taskqueue_enqueue_fn enqueue" "void *context" "init" @@ -243,9 +244,14 @@ A convenience macro, is provided to initialise a .Va task structure. +The +.Fn TASK_INITIALIZER +macro generates an initializer for a task structure. A macro .Fn TIMEOUT_TASK_INIT "queue" "timeout_task" "priority" "func" "context" -initializes the timeout_task structure. +initializes the +.Va timeout_task +structure. The values of .Va priority , .Va func , Modified: head/sys/sys/taskqueue.h ============================================================================== --- head/sys/sys/taskqueue.h Mon Dec 19 18:08:31 2011 (r228714) +++ head/sys/sys/taskqueue.h Mon Dec 19 18:55:13 2011 (r228715) @@ -77,6 +77,12 @@ void taskqueue_block(struct taskqueue *q void taskqueue_unblock(struct taskqueue *queue); int taskqueue_member(struct taskqueue *queue, struct thread *td); +#define TASK_INITIALIZER(priority, func, context) \ + { .ta_pending = 0, \ + .ta_priority = (priority), \ + .ta_func = (func), \ + .ta_context = (context) } + /* * Functions for dedicated thread taskqueues */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112191855.pBJItDl0070755>