Print this page
8158 Want named threads API
9857 proc manpages should have LIBRARY section
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/thread.h
+++ new/usr/src/head/thread.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
24 24 *
25 25 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
26 26 * Use is subject to license terms.
27 + *
28 + * Copyright 2018 Joyent, Inc.
27 29 */
28 30
29 31 #ifndef _THREAD_H
30 32 #define _THREAD_H
31 33
32 34 /*
33 35 * thread.h:
34 36 * definitions needed to use the thread interface except synchronization.
35 37 * use <synch.h> for thread synchronization.
36 38 */
37 39
38 40 #ifndef _ASM
39 41 #include <sys/signal.h>
40 42 #include <sys/time.h>
41 43 #include <synch.h>
42 44 #endif /* _ASM */
43 45
44 46 #ifdef __cplusplus
45 47 extern "C" {
46 48 #endif
47 49
48 50 #ifndef _ASM
49 51 typedef unsigned int thread_t;
50 52 typedef unsigned int thread_key_t;
51 53
52 54 extern int thr_create(void *, size_t, void *(*)(void *), void *, long,
53 55 thread_t *);
54 56 extern int thr_join(thread_t, thread_t *, void **);
55 57 extern int thr_setconcurrency(int);
56 58 extern int thr_getconcurrency(void);
57 59 extern void thr_exit(void *) __NORETURN;
58 60 extern thread_t thr_self(void);
59 61
60 62 /*
61 63 * the definition of thr_sigsetmask() is not strict ansi-c since sigset_t is
62 64 * not in the strict ansi-c name space. Hence, include the prototype for
63 65 * thr_sigsetmask() only if strict ansi-c conformance is not turned on.
64 66 */
65 67 #if !defined(_STRICT_STDC) || defined(__EXTENSIONS__)
66 68 extern int thr_sigsetmask(int, const sigset_t *, sigset_t *);
67 69 #endif
68 70
69 71 /*
70 72 * the definition of thr_stksegment() is not strict ansi-c since stack_t is
71 73 * not in the strict ansi-c name space. Hence, include the prototype for
72 74 * thr_stksegment() only if strict ansi-c conformance is not turned on.
73 75 */
74 76 #if !defined(_STRICT_STDC) || defined(__EXTENSIONS__)
75 77 extern int thr_stksegment(stack_t *);
76 78 #endif
77 79
78 80 extern int thr_main(void);
79 81 extern int thr_kill(thread_t, int);
↓ open down ↓ |
43 lines elided |
↑ open up ↑ |
80 82 extern int thr_suspend(thread_t);
81 83 extern int thr_continue(thread_t);
82 84 extern void thr_yield(void);
83 85 extern int thr_setprio(thread_t, int);
84 86 extern int thr_getprio(thread_t, int *);
85 87 extern int thr_keycreate(thread_key_t *, void(*)(void *));
86 88 extern int thr_keycreate_once(thread_key_t *, void(*)(void *));
87 89 extern int thr_setspecific(thread_key_t, void *);
88 90 extern int thr_getspecific(thread_key_t, void **);
89 91 extern size_t thr_min_stack(void);
92 +extern int thr_getname(thread_t, char *, size_t);
93 +extern int thr_setname(thread_t, const char *);
90 94
91 95 #endif /* _ASM */
92 96
93 97 #define THR_MIN_STACK thr_min_stack()
94 98 /*
95 99 * thread flags (one word bit mask)
96 100 */
97 101 /*
98 102 * POSIX.1c Note:
99 103 * THR_BOUND is defined same as PTHREAD_SCOPE_SYSTEM in <pthread.h>
100 104 * THR_DETACHED is defined same as PTHREAD_CREATE_DETACHED in <pthread.h>
101 105 * Any changes in these definitions should be reflected in <pthread.h>
102 106 */
103 107 #define THR_BOUND 0x00000001 /* = PTHREAD_SCOPE_SYSTEM */
104 108 #define THR_NEW_LWP 0x00000002
105 109 #define THR_DETACHED 0x00000040 /* = PTHREAD_CREATE_DETACHED */
106 110 #define THR_SUSPENDED 0x00000080
107 111 #define THR_DAEMON 0x00000100
108 112
109 113 /*
110 114 * The key to be created by thr_keycreate_once()
111 115 * must be statically initialized with THR_ONCE_KEY.
112 116 * This must be the same as PTHREAD_ONCE_KEY_NP in <pthread.h>
113 117 */
114 118 #define THR_ONCE_KEY (thread_key_t)(-1)
115 119
116 120 /*
117 121 * The available register states returned by thr_getstate().
118 122 */
119 123 #define TRS_VALID 0
120 124 #define TRS_NONVOLATILE 1
121 125 #define TRS_LWPID 2
122 126 #define TRS_INVALID 3
123 127
124 128 #ifdef __cplusplus
125 129 }
126 130 #endif
127 131
128 132 #endif /* _THREAD_H */
↓ open down ↓ |
29 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX