1 '\" te
2 .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH TASKQ 9F "Mar 1, 2005"
8 .SH NAME
9 taskq, ddi_taskq_create, ddi_taskq_destroy, ddi_taskq_dispatch, ddi_taskq_wait,
10 ddi_taskq_suspend, taskq_suspended, ddi_taskq_resume \- Kernel task queue
11 operations
12 .SH SYNOPSIS
13 .LP
14 .nf
15 #include <sys/sunddi.h>
16
17 \fBddi_taskq_t *\fR\fBddi_taskq_create\fR(\fBdev_info_t *\fR\fIdip\fR, \fBconst char *\fR\fIname\fR,
18 \fBint\fR \fInthreads\fR, \fBpri_t\fR \fIpri\fR, \fBuint_t\fR \fIcflags\fR);
19 .fi
20
21 .LP
22 .nf
23 \fBvoid\fR \fBddi_taskq_destroy\fR(\fBddi_taskq_t *\fR\fItq\fR);
24 .fi
25
26 .LP
27 .nf
170 .SH DESCRIPTION
171 .sp
172 .LP
173 A kernel task queue is a mechanism for general-purpose asynchronous task
174 scheduling that enables tasks to be performed at a later time by another
175 thread. There are several reasons why you may utilize asynchronous task
176 scheduling:
177 .RS +4
178 .TP
179 1.
180 You have a task that isn't time-critical, but a current code path that is.
181 .RE
182 .RS +4
183 .TP
184 2.
185 You have a task that may require grabbing locks that a thread already holds.
186 .RE
187 .RS +4
188 .TP
189 3.
190 You have a task that needs to block (for example, to wait for memory), but a
191 have a thread that cannot block in its current context.
192 .RE
193 .RS +4
194 .TP
195 4.
196 You have a code path that can't complete because of a specific condition,
197 but also can't sleep or fail. In this case, the task is immediately queued and
198 then is executed after the condition disappears.
199 .RE
200 .RS +4
201 .TP
202 5.
203 A task queue is just a simple way to launch multiple tasks in parallel.
204 .RE
205 .sp
206 .LP
207 A task queue consists of a list of tasks, together with one or more threads to
208 service the list. If a task queue has a single service thread, all tasks are
209 guaranteed to execute in the order they were dispatched. Otherwise they can be
210 executed in any order. Note that since tasks are placed on a list, execution of
211 one task and should not depend on the execution of another task or a deadlock
212 may occur. A \fBtaskq\fR created with a single servicing thread guarantees that
213 all the tasks are serviced in the order in which they are scheduled.
214 .sp
215 .LP
216 The \fBddi_taskq_create()\fR function creates a task queue instance.
217 .sp
218 .LP
219 The \fBddi_taskq_dispatch()\fR function places \fBtaskq\fR on the list for
220 later execution. The \fIdflag\fR argument specifies whether it is allowed sleep
221 waiting for memory. DDI_SLEEP dispatches can sleep and are guaranteed to
222 succeed. DDI_NOSLEEP dispatches are guaranteed not to sleep but may fail
223 (return \fBDDI_FAILURE\fR) if resources are not available.
224 .sp
225 .LP
226 The \fBddi_taskq_destroy()\fR function waits for any scheduled tasks to
227 complete, then destroys the \fBtaskq\fR. The caller should guarantee that no
228 new tasks are scheduled for the closing \fBtaskq\fR.
229 .sp
230 .LP
231 The \fBddi_taskq_wait()\fR function waits for all previously scheduled tasks to
232 complete. Note that this function does not stop any new task dispatches.
233 .sp
|
1 '\" te
2 .\" Copyright (c) 2005, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright 1989 AT&T
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH TASKQ 9F "Jul 25, 2015"
8 .SH NAME
9 taskq, ddi_taskq_create, ddi_taskq_destroy, ddi_taskq_dispatch, ddi_taskq_wait,
10 ddi_taskq_suspend, taskq_suspended, ddi_taskq_resume \- Kernel task queue
11 operations
12 .SH SYNOPSIS
13 .LP
14 .nf
15 #include <sys/sunddi.h>
16
17 \fBddi_taskq_t *\fR\fBddi_taskq_create\fR(\fBdev_info_t *\fR\fIdip\fR, \fBconst char *\fR\fIname\fR,
18 \fBint\fR \fInthreads\fR, \fBpri_t\fR \fIpri\fR, \fBuint_t\fR \fIcflags\fR);
19 .fi
20
21 .LP
22 .nf
23 \fBvoid\fR \fBddi_taskq_destroy\fR(\fBddi_taskq_t *\fR\fItq\fR);
24 .fi
25
26 .LP
27 .nf
170 .SH DESCRIPTION
171 .sp
172 .LP
173 A kernel task queue is a mechanism for general-purpose asynchronous task
174 scheduling that enables tasks to be performed at a later time by another
175 thread. There are several reasons why you may utilize asynchronous task
176 scheduling:
177 .RS +4
178 .TP
179 1.
180 You have a task that isn't time-critical, but a current code path that is.
181 .RE
182 .RS +4
183 .TP
184 2.
185 You have a task that may require grabbing locks that a thread already holds.
186 .RE
187 .RS +4
188 .TP
189 3.
190 You have a task that needs to block (for example, to wait for memory), but you
191 have a thread that cannot block in its current context.
192 .RE
193 .RS +4
194 .TP
195 4.
196 You have a code path that can't complete because of a specific condition,
197 but also can't sleep or fail. In this case, the task is immediately queued and
198 then is executed after the condition disappears.
199 .RE
200 .RS +4
201 .TP
202 5.
203 A task queue is just a simple way to launch multiple tasks in parallel.
204 .RE
205 .sp
206 .LP
207 A task queue consists of a list of tasks, together with one or more threads to
208 service the list. If a task queue has a single service thread, all tasks are
209 guaranteed to execute in the order they were dispatched. Otherwise they can be
210 executed in any order. Note that since tasks are placed on a list, execution of
211 one task should not depend on the execution of another task or a deadlock
212 may occur.
213 .sp
214 .LP
215 The \fBddi_taskq_create()\fR function creates a task queue instance.
216 .sp
217 .LP
218 The \fBddi_taskq_dispatch()\fR function places \fBtaskq\fR on the list for
219 later execution. The \fIdflag\fR argument specifies whether it is allowed sleep
220 waiting for memory. DDI_SLEEP dispatches can sleep and are guaranteed to
221 succeed. DDI_NOSLEEP dispatches are guaranteed not to sleep but may fail
222 (return \fBDDI_FAILURE\fR) if resources are not available.
223 .sp
224 .LP
225 The \fBddi_taskq_destroy()\fR function waits for any scheduled tasks to
226 complete, then destroys the \fBtaskq\fR. The caller should guarantee that no
227 new tasks are scheduled for the closing \fBtaskq\fR.
228 .sp
229 .LP
230 The \fBddi_taskq_wait()\fR function waits for all previously scheduled tasks to
231 complete. Note that this function does not stop any new task dispatches.
232 .sp
|