6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
26 */
27
28 #ifndef _SYS_TASKQ_H
29 #define _SYS_TASKQ_H
30
31 #include <sys/types.h>
32 #include <sys/thread.h>
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 #define TASKQ_NAMELEN 31
39
40 typedef struct taskq taskq_t;
41 typedef uintptr_t taskqid_t;
42 typedef void (task_func_t)(void *);
43
44 struct proc;
45
63 #define TQ_FRONT 0x08 /* Put task at the front of the queue */
64
65 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
66
67 extern taskq_t *system_taskq;
68
69 extern void taskq_init(void);
70 extern void taskq_mp_init(void);
71
72 extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t);
73 extern taskq_t *taskq_create_instance(const char *, int, int, pri_t, int,
74 int, uint_t);
75 extern taskq_t *taskq_create_proc(const char *, int, pri_t, int, int,
76 struct proc *, uint_t);
77 extern taskq_t *taskq_create_sysdc(const char *, int, int, int,
78 struct proc *, uint_t, uint_t);
79 extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t);
80 extern void nulltask(void *);
81 extern void taskq_destroy(taskq_t *);
82 extern void taskq_wait(taskq_t *);
83 extern void taskq_suspend(taskq_t *);
84 extern int taskq_suspended(taskq_t *);
85 extern void taskq_resume(taskq_t *);
86 extern int taskq_member(taskq_t *, kthread_t *);
87
88 #endif /* _KERNEL */
89
90 #ifdef __cplusplus
91 }
92 #endif
93
94 #endif /* _SYS_TASKQ_H */
|
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 *
25 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
26 * Copyright 2018, Joyent, Inc.
27 */
28
29 #ifndef _SYS_TASKQ_H
30 #define _SYS_TASKQ_H
31
32 #include <sys/types.h>
33 #include <sys/thread.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #define TASKQ_NAMELEN 31
40
41 typedef struct taskq taskq_t;
42 typedef uintptr_t taskqid_t;
43 typedef void (task_func_t)(void *);
44
45 struct proc;
46
64 #define TQ_FRONT 0x08 /* Put task at the front of the queue */
65
66 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
67
68 extern taskq_t *system_taskq;
69
70 extern void taskq_init(void);
71 extern void taskq_mp_init(void);
72
73 extern taskq_t *taskq_create(const char *, int, pri_t, int, int, uint_t);
74 extern taskq_t *taskq_create_instance(const char *, int, int, pri_t, int,
75 int, uint_t);
76 extern taskq_t *taskq_create_proc(const char *, int, pri_t, int, int,
77 struct proc *, uint_t);
78 extern taskq_t *taskq_create_sysdc(const char *, int, int, int,
79 struct proc *, uint_t, uint_t);
80 extern taskqid_t taskq_dispatch(taskq_t *, task_func_t, void *, uint_t);
81 extern void nulltask(void *);
82 extern void taskq_destroy(taskq_t *);
83 extern void taskq_wait(taskq_t *);
84 extern boolean_t taskq_empty(taskq_t *);
85 extern void taskq_suspend(taskq_t *);
86 extern int taskq_suspended(taskq_t *);
87 extern void taskq_resume(taskq_t *);
88 extern int taskq_member(taskq_t *, kthread_t *);
89
90 #endif /* _KERNEL */
91
92 #ifdef __cplusplus
93 }
94 #endif
95
96 #endif /* _SYS_TASKQ_H */
|