Deleted Added
full compact
taskqueue.9 (213813) taskqueue.9 (215011)
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 2000 Doug Rabson
4.\"
5.\" All rights reserved.
6.\"
7.\" This program is free software.
8.\"

--- 12 unchanged lines hidden (view full) ---

21.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28.\"
1.\" -*- nroff -*-
2.\"
3.\" Copyright (c) 2000 Doug Rabson
4.\"
5.\" All rights reserved.
6.\"
7.\" This program is free software.
8.\"

--- 12 unchanged lines hidden (view full) ---

21.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28.\"
29.\" $FreeBSD: head/share/man/man9/taskqueue.9 213813 2010-10-13 22:59:04Z mdf $
29.\" $FreeBSD: head/share/man/man9/taskqueue.9 215011 2010-11-08 20:56:31Z mdf $
30.\"
31.Dd August 18, 2009
32.Dt TASKQUEUE 9
33.Os
34.Sh NAME
35.Nm taskqueue
36.Nd asynchronous task execution
37.Sh SYNOPSIS

--- 20 unchanged lines hidden (view full) ---

58.Ft struct taskqueue *
59.Fn taskqueue_create_fast "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context"
60.Ft void
61.Fn taskqueue_free "struct taskqueue *queue"
62.Ft int
63.Fn taskqueue_enqueue "struct taskqueue *queue" "struct task *task"
64.Ft int
65.Fn taskqueue_enqueue_fast "struct taskqueue *queue" "struct task *task"
30.\"
31.Dd August 18, 2009
32.Dt TASKQUEUE 9
33.Os
34.Sh NAME
35.Nm taskqueue
36.Nd asynchronous task execution
37.Sh SYNOPSIS

--- 20 unchanged lines hidden (view full) ---

58.Ft struct taskqueue *
59.Fn taskqueue_create_fast "const char *name" "int mflags" "taskqueue_enqueue_fn enqueue" "void *context"
60.Ft void
61.Fn taskqueue_free "struct taskqueue *queue"
62.Ft int
63.Fn taskqueue_enqueue "struct taskqueue *queue" "struct task *task"
64.Ft int
65.Fn taskqueue_enqueue_fast "struct taskqueue *queue" "struct task *task"
66.Ft int
67.Fn taskqueue_cancel "struct taskqueue *queue" "struct task *task" "u_int *pendp"
66.Ft void
67.Fn taskqueue_drain "struct taskqueue *queue" "struct task *task"
68.Ft int
69.Fn taskqueue_member "struct taskqueue *queue" "struct thread *td"
70.Ft void
71.Fn taskqueue_run "struct taskqueue *queue"
72.Fn TASK_INIT "struct task *task" "int priority" "task_fn_t *func" "void *context"
73.Fn TASKQUEUE_DECLARE "name"

--- 83 unchanged lines hidden (view full) ---

157After the function
158.Va ta_func
159returns,
160.Xr wakeup 9
161is called on the task pointer passed to
162.Fn taskqueue_enqueue .
163.Pp
164The
68.Ft void
69.Fn taskqueue_drain "struct taskqueue *queue" "struct task *task"
70.Ft int
71.Fn taskqueue_member "struct taskqueue *queue" "struct thread *td"
72.Ft void
73.Fn taskqueue_run "struct taskqueue *queue"
74.Fn TASK_INIT "struct task *task" "int priority" "task_fn_t *func" "void *context"
75.Fn TASKQUEUE_DECLARE "name"

--- 83 unchanged lines hidden (view full) ---

159After the function
160.Va ta_func
161returns,
162.Xr wakeup 9
163is called on the task pointer passed to
164.Fn taskqueue_enqueue .
165.Pp
166The
167.Fn taskqueue_cancel
168function is used to cancel a task.
169The
170.Va ta_pending
171count is cleared, and the old value returned in the reference
172parameter
173.Fa pendp ,
174if it is non- Dv NULL .
175If the task is currently running,
176.Dv EBUSY
177is returned, otherwise 0.
178To implement a blocking
179.Fn taskqueue_cancel
180that waits for a running task to finish, it could look like:
181.Bd -literal -offset indent
182while (taskqueue_cancel(tq, task, NULL) != 0)
183 taskqueue_drain(tq, task);
184.Ed
185.Pp
186Note that, as with
187.Fn taskqueue_drain ,
188the caller is responsible for ensuring that the task is not re-enqueued
189after being canceled.
190.Pp
191The
165.Fn taskqueue_drain
166function is used to wait for the task to finish.
167There is no guarantee that the task will not be
168enqueued after call to
169.Fn taskqueue_drain .
170.Pp
171The
172.Fn taskqueue_member

--- 149 unchanged lines hidden ---
192.Fn taskqueue_drain
193function is used to wait for the task to finish.
194There is no guarantee that the task will not be
195enqueued after call to
196.Fn taskqueue_drain .
197.Pp
198The
199.Fn taskqueue_member

--- 149 unchanged lines hidden ---