taskqueue.9 (136971) | taskqueue.9 (140140) |
---|---|
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 136971 2004-10-26 17:14:45Z bms $ | 29.\" $FreeBSD: head/share/man/man9/taskqueue.9 140140 2005-01-12 21:48:25Z ru $ |
30.\" 31.Dd May 12, 2000 32.Dt TASKQUEUE 9 33.Os 34.Sh NAME 35.Nm taskqueue 36.Nd asynchronous task execution 37.Sh SYNOPSIS --- 123 unchanged lines hidden (view full) --- 161field is cleared. 162.Pp 163Three macros 164.Fn TASKQUEUE_DECLARE "name" , 165.Fn TASKQUEUE_DEFINE "name" "enqueue" "context" "init" , 166and 167.Fn TASKQUEUE_DEFINE_THREAD "name" 168are used to declare a reference to a global queue, to define the | 30.\" 31.Dd May 12, 2000 32.Dt TASKQUEUE 9 33.Os 34.Sh NAME 35.Nm taskqueue 36.Nd asynchronous task execution 37.Sh SYNOPSIS --- 123 unchanged lines hidden (view full) --- 161field is cleared. 162.Pp 163Three macros 164.Fn TASKQUEUE_DECLARE "name" , 165.Fn TASKQUEUE_DEFINE "name" "enqueue" "context" "init" , 166and 167.Fn TASKQUEUE_DEFINE_THREAD "name" 168are used to declare a reference to a global queue, to define the |
169implementation of the queue, and declare a queue that uses it's own thread. | 169implementation of the queue, and declare a queue that uses its own thread. |
170The 171.Fn TASKQUEUE_DEFINE 172macro arranges to call 173.Fn taskqueue_create 174with the values of its 175.Va name , 176.Va enqueue 177and --- 4 unchanged lines hidden (view full) --- 182the 183.Va init 184argument to the macro is executed as a C statement, 185allowing any further initialisation to be performed 186(such as registering an interrupt handler etc.) 187.Pp 188The 189.Fn TASKQUEUE_DEFINE_THREAD | 170The 171.Fn TASKQUEUE_DEFINE 172macro arranges to call 173.Fn taskqueue_create 174with the values of its 175.Va name , 176.Va enqueue 177and --- 4 unchanged lines hidden (view full) --- 182the 183.Va init 184argument to the macro is executed as a C statement, 185allowing any further initialisation to be performed 186(such as registering an interrupt handler etc.) 187.Pp 188The 189.Fn TASKQUEUE_DEFINE_THREAD |
190macro defines a new taskqueue with it's own kernel thread to serve tasks. The 191variable | 190macro defines a new taskqueue with its own kernel thread to serve tasks. 191The variable |
192.Vt struct proc *taskqueue_name_proc 193is defined which contains the kernel thread serving the tasks. 194The variable 195.Vt struct taskqueue *taskqueue_name 196is used to enqueue tasks onto the queue. 197.Pp 198The system provides three global taskqueues, 199.Va taskqueue_swi , --- 8 unchanged lines hidden (view full) --- 208this thread do not run under the Giant kernel lock. 209If the caller wants to run under Giant, he should explicitly acquire and 210release Giant in his taskqueue handler routine. 211.Pp 212To use these queues, 213call 214.Fn taskqueue_enqueue 215with the value of the global taskqueue variable for the queue you wish to | 192.Vt struct proc *taskqueue_name_proc 193is defined which contains the kernel thread serving the tasks. 194The variable 195.Vt struct taskqueue *taskqueue_name 196is used to enqueue tasks onto the queue. 197.Pp 198The system provides three global taskqueues, 199.Va taskqueue_swi , --- 8 unchanged lines hidden (view full) --- 208this thread do not run under the Giant kernel lock. 209If the caller wants to run under Giant, he should explicitly acquire and 210release Giant in his taskqueue handler routine. 211.Pp 212To use these queues, 213call 214.Fn taskqueue_enqueue 215with the value of the global taskqueue variable for the queue you wish to |
216use ( 217.Va taskqueue_swi , | 216use 217.Va ( taskqueue_swi , |
218.Va taskqueue_swi_giant , 219or | 218.Va taskqueue_swi_giant , 219or |
220.Va taskqueue_thread 221). | 220.Va taskqueue_thread ) . |
222.Pp 223The software interrupt queues can be used, 224for instance, for implementing interrupt handlers which must perform a 225significant amount of processing in the handler. 226The hardware interrupt handler would perform minimal processing of the 227interrupt and then enqueue a task to finish the work. 228This reduces to a minimum 229the amount of time spent with interrupts disabled. --- 12 unchanged lines hidden --- | 221.Pp 222The software interrupt queues can be used, 223for instance, for implementing interrupt handlers which must perform a 224significant amount of processing in the handler. 225The hardware interrupt handler would perform minimal processing of the 226interrupt and then enqueue a task to finish the work. 227This reduces to a minimum 228the amount of time spent with interrupts disabled. --- 12 unchanged lines hidden --- |