Blame


1 cfa37a7b 2004-04-10 devnull .TH THREAD 3
2 b2cfc4e2 2003-09-30 devnull .SH NAME
3 b2cfc4e2 2003-09-30 devnull alt,
4 b2cfc4e2 2003-09-30 devnull chancreate,
5 b2cfc4e2 2003-09-30 devnull chanfree,
6 b2cfc4e2 2003-09-30 devnull chanprint,
7 058b0118 2005-01-03 devnull chansetname,
8 b2cfc4e2 2003-09-30 devnull mainstacksize,
9 b2cfc4e2 2003-09-30 devnull proccreate,
10 b2cfc4e2 2003-09-30 devnull procdata,
11 b2cfc4e2 2003-09-30 devnull recv,
12 b2cfc4e2 2003-09-30 devnull recvp,
13 b2cfc4e2 2003-09-30 devnull recvul,
14 b2cfc4e2 2003-09-30 devnull send,
15 b2cfc4e2 2003-09-30 devnull sendp,
16 b2cfc4e2 2003-09-30 devnull sendul,
17 b2cfc4e2 2003-09-30 devnull nbrecv,
18 b2cfc4e2 2003-09-30 devnull nbrecvp,
19 b2cfc4e2 2003-09-30 devnull nbrecvul,
20 b2cfc4e2 2003-09-30 devnull nbsend,
21 b2cfc4e2 2003-09-30 devnull nbsendp,
22 b2cfc4e2 2003-09-30 devnull nbsendul,
23 b2cfc4e2 2003-09-30 devnull threadcreate,
24 b2cfc4e2 2003-09-30 devnull threaddata,
25 058b0118 2005-01-03 devnull threadexec,
26 058b0118 2005-01-03 devnull threadexecl,
27 b2cfc4e2 2003-09-30 devnull threadexits,
28 b2cfc4e2 2003-09-30 devnull threadexitsall,
29 b2cfc4e2 2003-09-30 devnull threadgetgrp,
30 b2cfc4e2 2003-09-30 devnull threadgetname,
31 b2cfc4e2 2003-09-30 devnull threadint,
32 b2cfc4e2 2003-09-30 devnull threadintgrp,
33 b2cfc4e2 2003-09-30 devnull threadkill,
34 b2cfc4e2 2003-09-30 devnull threadkillgrp,
35 b2cfc4e2 2003-09-30 devnull threadmain,
36 b2cfc4e2 2003-09-30 devnull threadnotify,
37 b2cfc4e2 2003-09-30 devnull threadid,
38 b2cfc4e2 2003-09-30 devnull threadpid,
39 df970459 2006-06-26 devnull threadpin,
40 df970459 2006-06-26 devnull threadunpin,
41 b2cfc4e2 2003-09-30 devnull threadsetgrp,
42 b2cfc4e2 2003-09-30 devnull threadsetname,
43 058b0118 2005-01-03 devnull threadsetstate,
44 058b0118 2005-01-03 devnull threadspawn,
45 9e4b56e7 2012-10-22 rsc threadspawnd,
46 e4d62adf 2005-01-18 devnull threadspawnl,
47 b2cfc4e2 2003-09-30 devnull threadwaitchan,
48 b2cfc4e2 2003-09-30 devnull yield \- thread and proc management
49 b2cfc4e2 2003-09-30 devnull .SH SYNOPSIS
50 b2cfc4e2 2003-09-30 devnull .PP
51 b2cfc4e2 2003-09-30 devnull .EX
52 b2cfc4e2 2003-09-30 devnull .ta 4n +4n +4n +4n +4n +4n +4n
53 b2cfc4e2 2003-09-30 devnull #include <u.h>
54 b2cfc4e2 2003-09-30 devnull #include <libc.h>
55 b2cfc4e2 2003-09-30 devnull #include <thread.h>
56 b2cfc4e2 2003-09-30 devnull .sp
57 b2cfc4e2 2003-09-30 devnull #define CHANEND 0
58 b2cfc4e2 2003-09-30 devnull #define CHANSND 1
59 b2cfc4e2 2003-09-30 devnull #define CHANRCV 2
60 b2cfc4e2 2003-09-30 devnull #define CHANNOP 3
61 b2cfc4e2 2003-09-30 devnull #define CHANNOBLK 4
62 b2cfc4e2 2003-09-30 devnull .sp
63 b2cfc4e2 2003-09-30 devnull .ta \w' 'u +\w'Channel 'u
64 b2cfc4e2 2003-09-30 devnull typedef struct Alt Alt;
65 b2cfc4e2 2003-09-30 devnull struct Alt {
66 b2cfc4e2 2003-09-30 devnull Channel *c;
67 b2cfc4e2 2003-09-30 devnull void *v;
68 b2cfc4e2 2003-09-30 devnull int op;
69 b2cfc4e2 2003-09-30 devnull Channel **tag;
70 b2cfc4e2 2003-09-30 devnull int entryno;
71 058b0118 2005-01-03 devnull char *name;
72 b2cfc4e2 2003-09-30 devnull };
73 b2cfc4e2 2003-09-30 devnull .fi
74 b2cfc4e2 2003-09-30 devnull .de XX
75 b5fdffee 2004-04-19 devnull .if t .sp 0.5
76 b5fdffee 2004-04-19 devnull .if n .sp
77 b2cfc4e2 2003-09-30 devnull ..
78 b2cfc4e2 2003-09-30 devnull .PP
79 b2cfc4e2 2003-09-30 devnull .nf
80 b2cfc4e2 2003-09-30 devnull .ft L
81 b2cfc4e2 2003-09-30 devnull .ta \w'\fLChannel* 'u +4n +4n +4n +4n
82 b2cfc4e2 2003-09-30 devnull void threadmain(int argc, char *argv[])
83 b2cfc4e2 2003-09-30 devnull int mainstacksize
84 b2cfc4e2 2003-09-30 devnull int proccreate(void (*fn)(void*), void *arg, uint stacksize)
85 b2cfc4e2 2003-09-30 devnull int threadcreate(void (*fn)(void*), void *arg, uint stacksize)
86 b2cfc4e2 2003-09-30 devnull void threadexits(char *status)
87 b2cfc4e2 2003-09-30 devnull void threadexitsall(char *status)
88 b2cfc4e2 2003-09-30 devnull void yield(void)
89 df970459 2006-06-26 devnull int threadpin(void)
90 df970459 2006-06-26 devnull int threadunpin(void)
91 b2cfc4e2 2003-09-30 devnull .XX
92 b2cfc4e2 2003-09-30 devnull int threadid(void)
93 b2cfc4e2 2003-09-30 devnull int threadgrp(void)
94 b2cfc4e2 2003-09-30 devnull int threadsetgrp(int group)
95 b2cfc4e2 2003-09-30 devnull int threadpid(int id)
96 b2cfc4e2 2003-09-30 devnull .XX
97 b2cfc4e2 2003-09-30 devnull int threadint(int id)
98 b2cfc4e2 2003-09-30 devnull int threadintgrp(int group)
99 b2cfc4e2 2003-09-30 devnull int threadkill(int id)
100 b2cfc4e2 2003-09-30 devnull int threadkillgrp(int group)
101 b2cfc4e2 2003-09-30 devnull .XX
102 b2cfc4e2 2003-09-30 devnull void threadsetname(char *name)
103 b2cfc4e2 2003-09-30 devnull char* threadgetname(void)
104 b2cfc4e2 2003-09-30 devnull .XX
105 b2cfc4e2 2003-09-30 devnull void** threaddata(void)
106 b2cfc4e2 2003-09-30 devnull void** procdata(void)
107 b2cfc4e2 2003-09-30 devnull .XX
108 b2cfc4e2 2003-09-30 devnull Channel* chancreate(int elsize, int nel)
109 b2cfc4e2 2003-09-30 devnull void chanfree(Channel *c)
110 b2cfc4e2 2003-09-30 devnull .XX
111 b2cfc4e2 2003-09-30 devnull int alt(Alt *alts)
112 b2cfc4e2 2003-09-30 devnull int recv(Channel *c, void *v)
113 b2cfc4e2 2003-09-30 devnull void* recvp(Channel *c)
114 b2cfc4e2 2003-09-30 devnull ulong recvul(Channel *c)
115 b2cfc4e2 2003-09-30 devnull int nbrecv(Channel *c, void *v)
116 b2cfc4e2 2003-09-30 devnull void* nbrecvp(Channel *c)
117 b2cfc4e2 2003-09-30 devnull ulong nbrecvul(Channel *c)
118 b2cfc4e2 2003-09-30 devnull int send(Channel *c, void *v)
119 b2cfc4e2 2003-09-30 devnull int sendp(Channel *c, void *v)
120 b2cfc4e2 2003-09-30 devnull int sendul(Channel *c, ulong v)
121 b2cfc4e2 2003-09-30 devnull int nbsend(Channel *c, void *v)
122 b2cfc4e2 2003-09-30 devnull int nbsendp(Channel *c, void *v)
123 b2cfc4e2 2003-09-30 devnull int nbsendul(Channel *c, ulong v)
124 b2cfc4e2 2003-09-30 devnull int chanprint(Channel *c, char *fmt, ...)
125 b2cfc4e2 2003-09-30 devnull .XX
126 e4d62adf 2005-01-18 devnull int threadspawnl(int fd[3], char *file, ...)
127 058b0118 2005-01-03 devnull int threadspawn(int fd[3], char *file, char *args[])
128 9e4b56e7 2012-10-22 rsc int threadspawnd(int fd[3], char *file, char *args[], char *dir)
129 058b0118 2005-01-03 devnull int threadexecl(Channel *cpid, int fd[3], char *file, ...)
130 058b0118 2005-01-03 devnull int threadexec(Channel *cpid, int fd[3], char *file, char *args[])
131 b2cfc4e2 2003-09-30 devnull Channel* threadwaitchan(void)
132 b2cfc4e2 2003-09-30 devnull .XX
133 b2cfc4e2 2003-09-30 devnull int threadnotify(int (*f)(void*, char*), int in)
134 b2cfc4e2 2003-09-30 devnull .EE
135 b2cfc4e2 2003-09-30 devnull .SH DESCRIPTION
136 b2cfc4e2 2003-09-30 devnull .PP
137 b2cfc4e2 2003-09-30 devnull The thread library provides parallel programming support similar to that
138 b2cfc4e2 2003-09-30 devnull of the languages
139 b2cfc4e2 2003-09-30 devnull Alef and Newsqueak.
140 b2cfc4e2 2003-09-30 devnull Threads
141 b2cfc4e2 2003-09-30 devnull and
142 b2cfc4e2 2003-09-30 devnull procs
143 b2cfc4e2 2003-09-30 devnull occupy a shared address space,
144 b2cfc4e2 2003-09-30 devnull communicating and synchronizing through
145 b2cfc4e2 2003-09-30 devnull .I channels
146 b2cfc4e2 2003-09-30 devnull and shared variables.
147 b2cfc4e2 2003-09-30 devnull .PP
148 b2cfc4e2 2003-09-30 devnull A
149 b2cfc4e2 2003-09-30 devnull .I proc
150 b2cfc4e2 2003-09-30 devnull is a Plan 9 process that contains one or more cooperatively scheduled
151 b2cfc4e2 2003-09-30 devnull .IR threads .
152 b2cfc4e2 2003-09-30 devnull Programs using threads must replace
153 b2cfc4e2 2003-09-30 devnull .I main
154 b2cfc4e2 2003-09-30 devnull by
155 b2cfc4e2 2003-09-30 devnull .IR threadmain .
156 b2cfc4e2 2003-09-30 devnull The thread library provides a
157 b2cfc4e2 2003-09-30 devnull .I main
158 b2cfc4e2 2003-09-30 devnull function that sets up a proc with a single thread executing
159 b2cfc4e2 2003-09-30 devnull .I threadmain
160 b2cfc4e2 2003-09-30 devnull on a stack of size
161 b2cfc4e2 2003-09-30 devnull .I mainstacksize
162 b2cfc4e2 2003-09-30 devnull (default eight kilobytes).
163 b2cfc4e2 2003-09-30 devnull To set
164 b2cfc4e2 2003-09-30 devnull .IR mainstacksize ,
165 b2cfc4e2 2003-09-30 devnull declare a global variable
166 b2cfc4e2 2003-09-30 devnull initialized to the desired value
167 b2cfc4e2 2003-09-30 devnull .RI ( e.g. ,
168 b2cfc4e2 2003-09-30 devnull .B int
169 b2cfc4e2 2003-09-30 devnull .B mainstacksize
170 b2cfc4e2 2003-09-30 devnull .B =
171 b2cfc4e2 2003-09-30 devnull .BR 1024 ).
172 0158bcee 2020-01-12 rsc When using the
173 0158bcee 2020-01-12 rsc .I pthread
174 0158bcee 2020-01-12 rsc library,
175 0158bcee 2020-01-12 rsc .B mainstacksize
176 0158bcee 2020-01-12 rsc is ignored, as is the stack size argument to
177 0158bcee 2020-01-12 rsc .BR proccreate :
178 0158bcee 2020-01-12 rsc the first thread in each proc
179 0158bcee 2020-01-12 rsc runs on the native system stack.
180 b2cfc4e2 2003-09-30 devnull .PP
181 b2cfc4e2 2003-09-30 devnull .I Threadcreate
182 b2cfc4e2 2003-09-30 devnull creates a new thread in the calling proc, returning a unique integer
183 b2cfc4e2 2003-09-30 devnull identifying the thread; the thread
184 b2cfc4e2 2003-09-30 devnull executes
185 b2cfc4e2 2003-09-30 devnull .I fn(arg)
186 b2cfc4e2 2003-09-30 devnull on a stack of size
187 b2cfc4e2 2003-09-30 devnull .IR stacksize .
188 b2cfc4e2 2003-09-30 devnull Thread stacks are allocated in shared memory, making it valid to pass
189 b2cfc4e2 2003-09-30 devnull pointers to stack variables between threads and procs.
190 058b0118 2005-01-03 devnull .I Proccreate
191 b2cfc4e2 2003-09-30 devnull creates a new proc, and inside that proc creates
192 b2cfc4e2 2003-09-30 devnull a single thread as
193 b2cfc4e2 2003-09-30 devnull .I threadcreate
194 b2cfc4e2 2003-09-30 devnull would,
195 b2cfc4e2 2003-09-30 devnull returning the id of the created thread.
196 058b0118 2005-01-03 devnull .\" .I Procrfork
197 058b0118 2005-01-03 devnull .\" creates the new proc by calling
198 058b0118 2005-01-03 devnull .\" .B rfork
199 058b0118 2005-01-03 devnull .\" (see
200 058b0118 2005-01-03 devnull .\" .IR fork (3))
201 058b0118 2005-01-03 devnull .\" with flags
202 058b0118 2005-01-03 devnull .\" .BR RFPROC|RFMEM|RFNOWAIT| \fIrforkflag\fR.
203 058b0118 2005-01-03 devnull .\" (The thread library depends on all its procs
204 058b0118 2005-01-03 devnull .\" running in the same rendezvous group.
205 058b0118 2005-01-03 devnull .\" Do not include
206 058b0118 2005-01-03 devnull .\" .B RFREND
207 058b0118 2005-01-03 devnull .\" in
208 058b0118 2005-01-03 devnull .\" .IR rforkflag .)
209 058b0118 2005-01-03 devnull .\" .I Proccreate
210 058b0118 2005-01-03 devnull .\" is identical to
211 058b0118 2005-01-03 devnull .\" .I procrfork
212 058b0118 2005-01-03 devnull .\" with
213 058b0118 2005-01-03 devnull .\" .I rforkflag
214 058b0118 2005-01-03 devnull .\" set to zero.
215 b2cfc4e2 2003-09-30 devnull Be aware that the calling thread may continue
216 b2cfc4e2 2003-09-30 devnull execution before
217 b2cfc4e2 2003-09-30 devnull the newly created proc and thread
218 b2cfc4e2 2003-09-30 devnull are scheduled.
219 b2cfc4e2 2003-09-30 devnull Because of this,
220 b2cfc4e2 2003-09-30 devnull .I arg
221 b2cfc4e2 2003-09-30 devnull should not point to data on the stack of a function that could
222 b2cfc4e2 2003-09-30 devnull return before the new process is scheduled.
223 b2cfc4e2 2003-09-30 devnull .PP
224 b2cfc4e2 2003-09-30 devnull .I Threadexits
225 b2cfc4e2 2003-09-30 devnull terminates the calling thread.
226 b2cfc4e2 2003-09-30 devnull If the thread is the last in its proc,
227 b2cfc4e2 2003-09-30 devnull .I threadexits
228 b2cfc4e2 2003-09-30 devnull also terminates the proc, using
229 b2cfc4e2 2003-09-30 devnull .I status
230 b2cfc4e2 2003-09-30 devnull as the exit status.
231 b2cfc4e2 2003-09-30 devnull .I Threadexitsall
232 b2cfc4e2 2003-09-30 devnull terminates all procs in the program,
233 b2cfc4e2 2003-09-30 devnull using
234 b2cfc4e2 2003-09-30 devnull .I status
235 b2cfc4e2 2003-09-30 devnull as the exit status.
236 b2cfc4e2 2003-09-30 devnull .PP
237 058b0118 2005-01-03 devnull When the last thread in
238 058b0118 2005-01-03 devnull .IR threadmain 's
239 058b0118 2005-01-03 devnull proc exits, the program will appear to its parent to have exited.
240 058b0118 2005-01-03 devnull The remaining procs will still run together, but as a background program.
241 058b0118 2005-01-03 devnull .PP
242 b2cfc4e2 2003-09-30 devnull The threads in a proc are coroutines, scheduled nonpreemptively
243 b2cfc4e2 2003-09-30 devnull in a round-robin fashion.
244 b2cfc4e2 2003-09-30 devnull A thread must explicitly relinquish control of the processor
245 b2cfc4e2 2003-09-30 devnull before another thread in the same proc is run.
246 b2cfc4e2 2003-09-30 devnull Calls that do this are
247 b2cfc4e2 2003-09-30 devnull .IR yield ,
248 b2cfc4e2 2003-09-30 devnull .IR proccreate ,
249 058b0118 2005-01-03 devnull .IR threadexec ,
250 058b0118 2005-01-03 devnull .IR threadexecl ,
251 b2cfc4e2 2003-09-30 devnull .IR threadexits ,
252 058b0118 2005-01-03 devnull .IR threadspawn ,
253 9e4b56e7 2012-10-22 rsc .IR threadspawnd ,
254 9e4b56e7 2012-10-22 rsc .IR threadspawnl ,
255 b2cfc4e2 2003-09-30 devnull .IR alt ,
256 b2cfc4e2 2003-09-30 devnull .IR send ,
257 b2cfc4e2 2003-09-30 devnull and
258 b2cfc4e2 2003-09-30 devnull .I recv
259 b2cfc4e2 2003-09-30 devnull (and the calls related to
260 b2cfc4e2 2003-09-30 devnull .I send
261 b2cfc4e2 2003-09-30 devnull and
262 b2cfc4e2 2003-09-30 devnull .IR recv \(emsee
263 b2cfc4e2 2003-09-30 devnull their descriptions further on).
264 b2cfc4e2 2003-09-30 devnull Procs are scheduled by the operating system.
265 b2cfc4e2 2003-09-30 devnull Therefore, threads in different procs can preempt one another
266 b2cfc4e2 2003-09-30 devnull in arbitrary ways and should synchronize their
267 b2cfc4e2 2003-09-30 devnull actions using
268 b2cfc4e2 2003-09-30 devnull .B qlocks
269 b2cfc4e2 2003-09-30 devnull (see
270 d32deab1 2020-08-16 rsc .MR lock (3) )
271 b2cfc4e2 2003-09-30 devnull or channel communication.
272 b2cfc4e2 2003-09-30 devnull System calls such as
273 d32deab1 2020-08-16 rsc .MR read (3)
274 b2cfc4e2 2003-09-30 devnull block the entire proc;
275 b2cfc4e2 2003-09-30 devnull all threads in a proc block until the system call finishes.
276 df970459 2006-06-26 devnull .PP
277 df970459 2006-06-26 devnull .I Threadpin
278 df970459 2006-06-26 devnull disables scheduling inside a proc, `pinning' the current
279 df970459 2006-06-26 devnull thread as the only runnable one in the current proc.
280 df970459 2006-06-26 devnull .I Threadunpin
281 df970459 2006-06-26 devnull reenables scheduling, allowing other procs to run once the current
282 df970459 2006-06-26 devnull thread relinquishes the processor.
283 df970459 2006-06-26 devnull .I Threadpin
284 df970459 2006-06-26 devnull and
285 df970459 2006-06-26 devnull .I threadunpin
286 df970459 2006-06-26 devnull can lead to deadlock.
287 df970459 2006-06-26 devnull Used carefully, they can make library routines that use
288 df970459 2006-06-26 devnull .B qlocks
289 df970459 2006-06-26 devnull appear atomic relative to the current proc, like a system call.
290 b2cfc4e2 2003-09-30 devnull .PP
291 b2cfc4e2 2003-09-30 devnull As mentioned above, each thread has a unique integer thread id.
292 b2cfc4e2 2003-09-30 devnull Thread ids are not reused; they are unique across the life of the program.
293 b2cfc4e2 2003-09-30 devnull .I Threadid
294 b2cfc4e2 2003-09-30 devnull returns the id for the current thread.
295 b2cfc4e2 2003-09-30 devnull Each thread also has a thread group id.
296 b2cfc4e2 2003-09-30 devnull The initial thread has a group id of zero.
297 b2cfc4e2 2003-09-30 devnull Each new thread inherits the group id of
298 b2cfc4e2 2003-09-30 devnull the thread that created it.
299 b2cfc4e2 2003-09-30 devnull .I Threadgrp
300 b2cfc4e2 2003-09-30 devnull returns the group id for the current thread;
301 b2cfc4e2 2003-09-30 devnull .I threadsetgrp
302 b2cfc4e2 2003-09-30 devnull sets it.
303 b2cfc4e2 2003-09-30 devnull .I Threadpid
304 b2cfc4e2 2003-09-30 devnull returns the pid of the Plan 9 process containing
305 b2cfc4e2 2003-09-30 devnull the thread identified by
306 b2cfc4e2 2003-09-30 devnull .IR id ,
307 b2cfc4e2 2003-09-30 devnull or \-1
308 b2cfc4e2 2003-09-30 devnull if no such thread is found.
309 b2cfc4e2 2003-09-30 devnull .PP
310 b2cfc4e2 2003-09-30 devnull .I Threadint
311 b2cfc4e2 2003-09-30 devnull interrupts a thread that is blocked in a channel operation
312 b2cfc4e2 2003-09-30 devnull or system call.
313 b2cfc4e2 2003-09-30 devnull .I Threadintgrp
314 b2cfc4e2 2003-09-30 devnull interrupts all threads with the given group id.
315 b2cfc4e2 2003-09-30 devnull .I Threadkill
316 b2cfc4e2 2003-09-30 devnull marks a thread to die when it next relinquishes the processor
317 b2cfc4e2 2003-09-30 devnull (via one of the calls listed above).
318 b2cfc4e2 2003-09-30 devnull If the thread is blocked in a channel operation or system call,
319 b2cfc4e2 2003-09-30 devnull it is also interrupted.
320 b2cfc4e2 2003-09-30 devnull .I Threadkillgrp
321 b2cfc4e2 2003-09-30 devnull kills all threads with the given group id.
322 b2cfc4e2 2003-09-30 devnull Note that
323 b2cfc4e2 2003-09-30 devnull .I threadkill
324 b2cfc4e2 2003-09-30 devnull and
325 b2cfc4e2 2003-09-30 devnull .I threadkillgrp
326 b2cfc4e2 2003-09-30 devnull will not terminate a thread that never relinquishes
327 b2cfc4e2 2003-09-30 devnull the processor.
328 b2cfc4e2 2003-09-30 devnull .PP
329 b2cfc4e2 2003-09-30 devnull Primarily for debugging,
330 b2cfc4e2 2003-09-30 devnull threads can have string names associated with them.
331 b2cfc4e2 2003-09-30 devnull .I Threadgetname
332 b2cfc4e2 2003-09-30 devnull returns the current thread's name;
333 b2cfc4e2 2003-09-30 devnull .I threadsetname
334 b2cfc4e2 2003-09-30 devnull sets it.
335 b2cfc4e2 2003-09-30 devnull The pointer returned by
336 b2cfc4e2 2003-09-30 devnull .I threadgetname
337 b2cfc4e2 2003-09-30 devnull is only valid until the next call to
338 b2cfc4e2 2003-09-30 devnull .IR threadsetname .
339 b2cfc4e2 2003-09-30 devnull .PP
340 058b0118 2005-01-03 devnull Also for debugging,
341 058b0118 2005-01-03 devnull threads have a string state associated with them.
342 058b0118 2005-01-03 devnull .I Threadsetstate
343 058b0118 2005-01-03 devnull sets the state string.
344 058b0118 2005-01-03 devnull There is no
345 058b0118 2005-01-03 devnull .IR threadgetstate ;
346 058b0118 2005-01-03 devnull since the thread scheduler resets the state to
347 058b0118 2005-01-03 devnull .B Running
348 058b0118 2005-01-03 devnull every time it runs the thread,
349 058b0118 2005-01-03 devnull it is only useful for debuggers to inspect the state.
350 058b0118 2005-01-03 devnull .PP
351 b2cfc4e2 2003-09-30 devnull .I Threaddata
352 b2cfc4e2 2003-09-30 devnull returns a pointer to a per-thread pointer
353 b2cfc4e2 2003-09-30 devnull that may be modified by threaded programs for
354 b2cfc4e2 2003-09-30 devnull per-thread storage.
355 b2cfc4e2 2003-09-30 devnull Similarly,
356 b2cfc4e2 2003-09-30 devnull .I procdata
357 b2cfc4e2 2003-09-30 devnull returns a pointer to a per-proc pointer.
358 b2cfc4e2 2003-09-30 devnull .PP
359 058b0118 2005-01-03 devnull .I Threadexecl
360 b2cfc4e2 2003-09-30 devnull and
361 058b0118 2005-01-03 devnull .I threadexec
362 b2cfc4e2 2003-09-30 devnull are threaded analogues of
363 b2cfc4e2 2003-09-30 devnull .I exec
364 b2cfc4e2 2003-09-30 devnull and
365 b2cfc4e2 2003-09-30 devnull .I execl
366 b2cfc4e2 2003-09-30 devnull (see
367 d32deab1 2020-08-16 rsc .MR exec (3) );
368 b2cfc4e2 2003-09-30 devnull on success,
369 058b0118 2005-01-03 devnull they replace the calling thread
370 b2cfc4e2 2003-09-30 devnull and invoke the external program, never returning.
371 058b0118 2005-01-03 devnull (Unlike on Plan 9, the calling thread need not be the only thread in its proc\(emthe other
372 058b0118 2005-01-03 devnull threads will continue executing.)
373 b2cfc4e2 2003-09-30 devnull On error, they return \-1.
374 b2cfc4e2 2003-09-30 devnull If
375 b2cfc4e2 2003-09-30 devnull .I cpid
376 b2cfc4e2 2003-09-30 devnull is not null, the pid of the invoked program
377 b2cfc4e2 2003-09-30 devnull will be sent along
378 b2cfc4e2 2003-09-30 devnull .I cpid
379 058b0118 2005-01-03 devnull (using
380 058b0118 2005-01-03 devnull .IR sendul )
381 b2cfc4e2 2003-09-30 devnull once the program has been started, or \-1 will be sent if an
382 b2cfc4e2 2003-09-30 devnull error occurs.
383 058b0118 2005-01-03 devnull .I Threadexec
384 b2cfc4e2 2003-09-30 devnull and
385 058b0118 2005-01-03 devnull .I threadexecl
386 b2cfc4e2 2003-09-30 devnull will not access their arguments after sending a result
387 b2cfc4e2 2003-09-30 devnull along
388 b2cfc4e2 2003-09-30 devnull .IR cpid .
389 b2cfc4e2 2003-09-30 devnull Thus, programs that malloc the
390 b2cfc4e2 2003-09-30 devnull .I argv
391 b2cfc4e2 2003-09-30 devnull passed to
392 058b0118 2005-01-03 devnull .I threadexec
393 b2cfc4e2 2003-09-30 devnull can safely free it once they have
394 b2cfc4e2 2003-09-30 devnull received the
395 b2cfc4e2 2003-09-30 devnull .I cpid
396 b2cfc4e2 2003-09-30 devnull response.
397 058b0118 2005-01-03 devnull .PP
398 058b0118 2005-01-03 devnull .I Threadexecl
399 058b0118 2005-01-03 devnull and
400 058b0118 2005-01-03 devnull .I threadexec
401 058b0118 2005-01-03 devnull will duplicate
402 058b0118 2005-01-03 devnull (see
403 d32deab1 2020-08-16 rsc .MR dup (3) )
404 058b0118 2005-01-03 devnull the three file descriptors in
405 058b0118 2005-01-03 devnull .I fd
406 058b0118 2005-01-03 devnull onto standard input, output, and error for the external program
407 058b0118 2005-01-03 devnull and then close them in the calling thread.
408 058b0118 2005-01-03 devnull Beware of code that sets
409 058b0118 2005-01-03 devnull .IP
410 058b0118 2005-01-03 devnull .EX
411 058b0118 2005-01-03 devnull fd[0] = 0;
412 058b0118 2005-01-03 devnull fd[1] = 1;
413 058b0118 2005-01-03 devnull fd[2] = 2;
414 058b0118 2005-01-03 devnull .EE
415 c8b6342d 2005-01-13 devnull .LP
416 058b0118 2005-01-03 devnull to use the current standard files. The correct code is
417 058b0118 2005-01-03 devnull .IP
418 058b0118 2005-01-03 devnull .EX
419 058b0118 2005-01-03 devnull fd[0] = dup(0, -1);
420 058b0118 2005-01-03 devnull fd[1] = dup(1, -1);
421 058b0118 2005-01-03 devnull fd[2] = dup(2, -1);
422 058b0118 2005-01-03 devnull .EE
423 058b0118 2005-01-03 devnull .PP
424 e4d62adf 2005-01-18 devnull .I Threadspawnl
425 e4d62adf 2005-01-18 devnull and
426 e4d62adf 2005-01-18 devnull .I threadspawn
427 e4d62adf 2005-01-18 devnull are like
428 e4d62adf 2005-01-18 devnull .I threadexecl
429 e4d62adf 2005-01-18 devnull and
430 058b0118 2005-01-03 devnull .I threadexec
431 e4d62adf 2005-01-18 devnull but do not replace the current thread.
432 e4d62adf 2005-01-18 devnull They return the pid of the invoked program on success, or
433 058b0118 2005-01-03 devnull \-1 on error.
434 9e4b56e7 2012-10-22 rsc .I Threadspawnd
435 9e4b56e7 2012-10-22 rsc is like
436 9e4b56e7 2012-10-22 rsc .I threadspawn
437 9e4b56e7 2012-10-22 rsc but takes as its final argument the directory in which to run the invoked program.
438 9e4b56e7 2012-10-22 rsc The child will attempt to change into that directory before running the program,
439 9e4b56e7 2012-10-22 rsc but it is only best effort: failure to change into the directory does not
440 9e4b56e7 2012-10-22 rsc stop the running of the program.
441 058b0118 2005-01-03 devnull .PP
442 b2cfc4e2 2003-09-30 devnull .I Threadwaitchan
443 b2cfc4e2 2003-09-30 devnull returns a channel of pointers to
444 b2cfc4e2 2003-09-30 devnull .B Waitmsg
445 b2cfc4e2 2003-09-30 devnull structures (see
446 d32deab1 2020-08-16 rsc .MR wait (3) ).
447 b2cfc4e2 2003-09-30 devnull When an exec'ed process exits, a pointer to a
448 b2cfc4e2 2003-09-30 devnull .B Waitmsg
449 b2cfc4e2 2003-09-30 devnull is sent to this channel.
450 b2cfc4e2 2003-09-30 devnull These
451 b2cfc4e2 2003-09-30 devnull .B Waitmsg
452 b2cfc4e2 2003-09-30 devnull structures have been allocated with
453 d32deab1 2020-08-16 rsc .MR malloc (3)
454 b2cfc4e2 2003-09-30 devnull and should be freed after use.
455 b2cfc4e2 2003-09-30 devnull .PP
456 b2cfc4e2 2003-09-30 devnull A
457 b2cfc4e2 2003-09-30 devnull .B Channel
458 b2cfc4e2 2003-09-30 devnull is a buffered or unbuffered queue for fixed-size messages.
459 b2cfc4e2 2003-09-30 devnull Procs and threads
460 b2cfc4e2 2003-09-30 devnull .I send
461 b2cfc4e2 2003-09-30 devnull messages into the channel and
462 b2cfc4e2 2003-09-30 devnull .I recv
463 b2cfc4e2 2003-09-30 devnull messages from the channel. If the channel is unbuffered, a
464 b2cfc4e2 2003-09-30 devnull .I send
465 b2cfc4e2 2003-09-30 devnull operation blocks until the corresponding
466 b2cfc4e2 2003-09-30 devnull .I recv
467 b2cfc4e2 2003-09-30 devnull operation occurs and
468 b2cfc4e2 2003-09-30 devnull .IR "vice versa" .
469 9ea7f9d8 2009-04-30 rsc .IR Chancreate
470 9ea7f9d8 2009-04-30 rsc allocates a new channel
471 b2cfc4e2 2003-09-30 devnull for messages of size
472 b2cfc4e2 2003-09-30 devnull .I elsize
473 b2cfc4e2 2003-09-30 devnull and with a buffer holding
474 b2cfc4e2 2003-09-30 devnull .I nel
475 b2cfc4e2 2003-09-30 devnull messages.
476 b2cfc4e2 2003-09-30 devnull If
477 b2cfc4e2 2003-09-30 devnull .I nel
478 b2cfc4e2 2003-09-30 devnull is zero, the channel is unbuffered.
479 b2cfc4e2 2003-09-30 devnull .I Chanfree
480 b2cfc4e2 2003-09-30 devnull frees a channel that is no longer used.
481 b2cfc4e2 2003-09-30 devnull .I Chanfree
482 b2cfc4e2 2003-09-30 devnull can be called by either sender or receiver after the last item has been
483 b2cfc4e2 2003-09-30 devnull sent or received. Freeing the channel will be delayed if there is a thread
484 b2cfc4e2 2003-09-30 devnull blocked on it until that thread unblocks (but
485 b2cfc4e2 2003-09-30 devnull .I chanfree
486 b2cfc4e2 2003-09-30 devnull returns immediately).
487 b2cfc4e2 2003-09-30 devnull .PP
488 058b0118 2005-01-03 devnull The
489 058b0118 2005-01-03 devnull .B name
490 058b0118 2005-01-03 devnull element in the
491 058b0118 2005-01-03 devnull .B Channel
492 058b0118 2005-01-03 devnull structure is a description intended for use in debugging.
493 058b0118 2005-01-03 devnull .I Chansetname
494 058b0118 2005-01-03 devnull sets the name.
495 058b0118 2005-01-03 devnull .PP
496 b2cfc4e2 2003-09-30 devnull .I Send
497 b2cfc4e2 2003-09-30 devnull sends the element pointed at by
498 b2cfc4e2 2003-09-30 devnull .I v
499 b2cfc4e2 2003-09-30 devnull to the channel
500 b2cfc4e2 2003-09-30 devnull .IR c .
501 b2cfc4e2 2003-09-30 devnull If
502 b2cfc4e2 2003-09-30 devnull .I v
503 b2cfc4e2 2003-09-30 devnull is null, zeros are sent.
504 b2cfc4e2 2003-09-30 devnull .I Recv
505 b2cfc4e2 2003-09-30 devnull receives an element from
506 b2cfc4e2 2003-09-30 devnull .I c
507 b2cfc4e2 2003-09-30 devnull and stores it in
508 b2cfc4e2 2003-09-30 devnull .IR v .
509 b2cfc4e2 2003-09-30 devnull If
510 b2cfc4e2 2003-09-30 devnull .I v
511 b2cfc4e2 2003-09-30 devnull is null,
512 b2cfc4e2 2003-09-30 devnull the received value is discarded.
513 b2cfc4e2 2003-09-30 devnull .I Send
514 b2cfc4e2 2003-09-30 devnull and
515 b2cfc4e2 2003-09-30 devnull .I recv
516 b2cfc4e2 2003-09-30 devnull return 1 on success, \-1 if interrupted.
517 b2cfc4e2 2003-09-30 devnull .I Nbsend
518 b2cfc4e2 2003-09-30 devnull and
519 b2cfc4e2 2003-09-30 devnull .I nbrecv
520 b2cfc4e2 2003-09-30 devnull behave similarly, but return 0 rather than blocking.
521 b2cfc4e2 2003-09-30 devnull .PP
522 b2cfc4e2 2003-09-30 devnull .IR Sendp ,
523 b2cfc4e2 2003-09-30 devnull .IR nbsendp ,
524 b2cfc4e2 2003-09-30 devnull .IR sendul ,
525 b2cfc4e2 2003-09-30 devnull and
526 b2cfc4e2 2003-09-30 devnull .I nbsendul
527 b2cfc4e2 2003-09-30 devnull send a pointer or an unsigned long; the channel must
528 b2cfc4e2 2003-09-30 devnull have been initialized with the appropriate
529 b2cfc4e2 2003-09-30 devnull .IR elsize .
530 b2cfc4e2 2003-09-30 devnull .IR Recvp ,
531 b2cfc4e2 2003-09-30 devnull .IR nbrecvp ,
532 b2cfc4e2 2003-09-30 devnull .IR recvul ,
533 b2cfc4e2 2003-09-30 devnull and
534 b2cfc4e2 2003-09-30 devnull .I nbrecvul
535 b2cfc4e2 2003-09-30 devnull receive a pointer or an unsigned long;
536 b2cfc4e2 2003-09-30 devnull they return zero when a zero is received,
537 b2cfc4e2 2003-09-30 devnull when interrupted, or
538 b2cfc4e2 2003-09-30 devnull (for
539 b2cfc4e2 2003-09-30 devnull .I nbrecvp
540 b2cfc4e2 2003-09-30 devnull and
541 b2cfc4e2 2003-09-30 devnull .IR nbrecvul )
542 b2cfc4e2 2003-09-30 devnull when the operation would have blocked.
543 b2cfc4e2 2003-09-30 devnull To distinguish between these three cases,
544 b2cfc4e2 2003-09-30 devnull use
545 b2cfc4e2 2003-09-30 devnull .I recv
546 b2cfc4e2 2003-09-30 devnull or
547 b2cfc4e2 2003-09-30 devnull .IR nbrecv .
548 b2cfc4e2 2003-09-30 devnull .PP
549 b2cfc4e2 2003-09-30 devnull .I Alt
550 b2cfc4e2 2003-09-30 devnull can be used to recv from or send to one of a number of channels,
551 b2cfc4e2 2003-09-30 devnull as directed by an array of
552 b2cfc4e2 2003-09-30 devnull .B Alt
553 b2cfc4e2 2003-09-30 devnull structures,
554 b2cfc4e2 2003-09-30 devnull each of which describes a potential send or receive operation.
555 b2cfc4e2 2003-09-30 devnull In an
556 b2cfc4e2 2003-09-30 devnull .B Alt
557 b2cfc4e2 2003-09-30 devnull structure,
558 b2cfc4e2 2003-09-30 devnull .B c
559 b2cfc4e2 2003-09-30 devnull is the channel;
560 b2cfc4e2 2003-09-30 devnull .B v
561 b2cfc4e2 2003-09-30 devnull the value pointer (which may be null); and
562 b2cfc4e2 2003-09-30 devnull .B op
563 b2cfc4e2 2003-09-30 devnull the operation:
564 b2cfc4e2 2003-09-30 devnull .B CHANSND
565 b2cfc4e2 2003-09-30 devnull for a send operation,
566 b2cfc4e2 2003-09-30 devnull .B CHANRECV
567 b2cfc4e2 2003-09-30 devnull for a recv operation;
568 b2cfc4e2 2003-09-30 devnull .B CHANNOP
569 b2cfc4e2 2003-09-30 devnull for no operation
570 b2cfc4e2 2003-09-30 devnull (useful
571 b2cfc4e2 2003-09-30 devnull when
572 b2cfc4e2 2003-09-30 devnull .I alt
573 b2cfc4e2 2003-09-30 devnull is called with a varying set of operations).
574 b2cfc4e2 2003-09-30 devnull The array of
575 b2cfc4e2 2003-09-30 devnull .B Alt
576 b2cfc4e2 2003-09-30 devnull structures is terminated by an entry with
577 b2cfc4e2 2003-09-30 devnull .I op
578 b2cfc4e2 2003-09-30 devnull .B CHANEND
579 b2cfc4e2 2003-09-30 devnull or
580 b2cfc4e2 2003-09-30 devnull .BR CHANNOBLK .
581 b2cfc4e2 2003-09-30 devnull If at least one
582 b2cfc4e2 2003-09-30 devnull .B Alt
583 b2cfc4e2 2003-09-30 devnull structure can proceed, one of them is
584 b2cfc4e2 2003-09-30 devnull chosen at random to be executed.
585 b2cfc4e2 2003-09-30 devnull .I Alt
586 b2cfc4e2 2003-09-30 devnull returns the index of the chosen structure.
587 b2cfc4e2 2003-09-30 devnull If no operations can proceed and the list is terminated with
588 b2cfc4e2 2003-09-30 devnull .BR CHANNOBLK ,
589 b2cfc4e2 2003-09-30 devnull .I alt
590 b2cfc4e2 2003-09-30 devnull returns the index of the terminating
591 b2cfc4e2 2003-09-30 devnull .B CHANNOBLK
592 b2cfc4e2 2003-09-30 devnull structure.
593 b2cfc4e2 2003-09-30 devnull Otherwise,
594 b2cfc4e2 2003-09-30 devnull .I alt
595 b2cfc4e2 2003-09-30 devnull blocks until one of the operations can proceed,
596 b2cfc4e2 2003-09-30 devnull eventually returning the index of the structure executes.
597 b2cfc4e2 2003-09-30 devnull .I Alt
598 b2cfc4e2 2003-09-30 devnull returns \-1 when interrupted.
599 b2cfc4e2 2003-09-30 devnull The
600 b2cfc4e2 2003-09-30 devnull .B tag
601 b2cfc4e2 2003-09-30 devnull and
602 b2cfc4e2 2003-09-30 devnull .B entryno
603 b2cfc4e2 2003-09-30 devnull fields in the
604 b2cfc4e2 2003-09-30 devnull .B Alt
605 b2cfc4e2 2003-09-30 devnull structure are used internally by
606 b2cfc4e2 2003-09-30 devnull .I alt
607 b2cfc4e2 2003-09-30 devnull and need not be initialized.
608 b2cfc4e2 2003-09-30 devnull They are not used between
609 b2cfc4e2 2003-09-30 devnull .I alt
610 b2cfc4e2 2003-09-30 devnull calls.
611 b2cfc4e2 2003-09-30 devnull .PP
612 b2cfc4e2 2003-09-30 devnull .I Chanprint
613 b2cfc4e2 2003-09-30 devnull formats its arguments in the manner of
614 d32deab1 2020-08-16 rsc .MR print (3)
615 b2cfc4e2 2003-09-30 devnull and sends the result to the channel
616 b2cfc4e2 2003-09-30 devnull .IR c.
617 b2cfc4e2 2003-09-30 devnull The string delivered by
618 b2cfc4e2 2003-09-30 devnull .I chanprint
619 b2cfc4e2 2003-09-30 devnull is allocated with
620 d32deab1 2020-08-16 rsc .MR malloc (3)
621 b2cfc4e2 2003-09-30 devnull and should be freed upon receipt.
622 b2cfc4e2 2003-09-30 devnull .PP
623 b2cfc4e2 2003-09-30 devnull Thread library functions do not return on failure;
624 b2cfc4e2 2003-09-30 devnull if errors occur, the entire program is aborted.
625 b2cfc4e2 2003-09-30 devnull .PP
626 b2cfc4e2 2003-09-30 devnull Threaded programs should use
627 b2cfc4e2 2003-09-30 devnull .I threadnotify
628 b2cfc4e2 2003-09-30 devnull in place of
629 b2cfc4e2 2003-09-30 devnull .I atnotify
630 b2cfc4e2 2003-09-30 devnull (see
631 d32deab1 2020-08-16 rsc .MR notify (3) ).
632 b2cfc4e2 2003-09-30 devnull .PP
633 b2cfc4e2 2003-09-30 devnull It is safe to use
634 d32deab1 2020-08-16 rsc .MR sysfatal (3)
635 b2cfc4e2 2003-09-30 devnull in threaded programs.
636 b2cfc4e2 2003-09-30 devnull .I Sysfatal
637 b2cfc4e2 2003-09-30 devnull will print the error string and call
638 b2cfc4e2 2003-09-30 devnull .IR threadexitsall .
639 b2cfc4e2 2003-09-30 devnull .PP
640 058b0118 2005-01-03 devnull It is not safe to call
641 b2cfc4e2 2003-09-30 devnull .IR rfork
642 058b0118 2005-01-03 devnull in a threaded program, except to call
643 058b0118 2005-01-03 devnull .B rfork(RFNOTEG)
644 058b0118 2005-01-03 devnull from the main proc before any other procs have been created.
645 058b0118 2005-01-03 devnull To create new processes, use
646 058b0118 2005-01-03 devnull .IR proccreate .
647 058b0118 2005-01-03 devnull .\" .PP
648 058b0118 2005-01-03 devnull .\" It is safe to use
649 058b0118 2005-01-03 devnull .\" .IR rfork
650 058b0118 2005-01-03 devnull .\" (see
651 058b0118 2005-01-03 devnull .\" .IR fork (3))
652 058b0118 2005-01-03 devnull .\" to manage the namespace, file descriptors, note group, and environment of a
653 058b0118 2005-01-03 devnull .\" single process.
654 058b0118 2005-01-03 devnull .\" That is, it is safe to call
655 058b0118 2005-01-03 devnull .\" .I rfork
656 058b0118 2005-01-03 devnull .\" with the flags
657 058b0118 2005-01-03 devnull .\" .BR RFNAMEG ,
658 058b0118 2005-01-03 devnull .\" .BR RFFDG ,
659 058b0118 2005-01-03 devnull .\" .BR RFCFDG ,
660 058b0118 2005-01-03 devnull .\" .BR RFNOTEG ,
661 058b0118 2005-01-03 devnull .\" .BR RFENVG ,
662 058b0118 2005-01-03 devnull .\" and
663 058b0118 2005-01-03 devnull .\" .BR RFCENVG.
664 058b0118 2005-01-03 devnull .\" (To create new processes, use
665 058b0118 2005-01-03 devnull .\" .I proccreate
666 058b0118 2005-01-03 devnull .\" and
667 058b0118 2005-01-03 devnull .\" .IR procrfork .)
668 058b0118 2005-01-03 devnull .\" As mentioned above,
669 058b0118 2005-01-03 devnull .\" the thread library depends on all procs being in the
670 058b0118 2005-01-03 devnull .\" same rendezvous group; do not change the rendezvous
671 058b0118 2005-01-03 devnull .\" group with
672 058b0118 2005-01-03 devnull .\" .IR rfork .
673 b2cfc4e2 2003-09-30 devnull .SH FILES
674 c3674de4 2005-01-11 devnull .B \*9/acid/thread
675 b2cfc4e2 2003-09-30 devnull contains useful
676 d32deab1 2020-08-16 rsc .MR acid (1)
677 b2cfc4e2 2003-09-30 devnull functions for debugging threaded programs.
678 b2cfc4e2 2003-09-30 devnull .PP
679 c3674de4 2005-01-11 devnull .B \*9/src/libthread/test
680 058b0118 2005-01-03 devnull contains some example programs.
681 b2cfc4e2 2003-09-30 devnull .SH SOURCE
682 c3674de4 2005-01-11 devnull .B \*9/src/libthread
683 b2cfc4e2 2003-09-30 devnull .SH SEE ALSO
684 d32deab1 2020-08-16 rsc .MR intro (3) ,
685 d32deab1 2020-08-16 rsc .MR ioproc (3)
686 058b0118 2005-01-03 devnull .SH BUGS
687 058b0118 2005-01-03 devnull To avoid name conflicts,
688 058b0118 2005-01-03 devnull .IR alt ,
689 058b0118 2005-01-03 devnull .IR nbrecv ,
690 058b0118 2005-01-03 devnull .IR nbrecvp ,
691 058b0118 2005-01-03 devnull .IR nbrecvul ,
692 058b0118 2005-01-03 devnull .IR nbsend ,
693 058b0118 2005-01-03 devnull .IR nbsendp ,
694 058b0118 2005-01-03 devnull .IR nbsendul ,
695 058b0118 2005-01-03 devnull .IR recv ,
696 058b0118 2005-01-03 devnull .IR recvp ,
697 058b0118 2005-01-03 devnull .IR recvul ,
698 058b0118 2005-01-03 devnull .IR send ,
699 058b0118 2005-01-03 devnull .IR sendp ,
700 058b0118 2005-01-03 devnull and
701 058b0118 2005-01-03 devnull .IR sendul
702 058b0118 2005-01-03 devnull are defined as macros that expand to
703 058b0118 2005-01-03 devnull .IR chanalt ,
704 058b0118 2005-01-03 devnull .IR channbrecv ,
705 058b0118 2005-01-03 devnull and so on.
706 c8b6342d 2005-01-13 devnull .I Yield
707 058b0118 2005-01-03 devnull is defined as a macro that expands to
708 058b0118 2005-01-03 devnull .IR threadyield .
709 c8b6342d 2005-01-13 devnull See
710 d32deab1 2020-08-16 rsc .MR intro (3) .
711 058b0118 2005-01-03 devnull .PP
712 e1df0680 2008-07-21 t.lainson Threadint,
713 e1df0680 2008-07-21 t.lainson threadintgrp,
714 e1df0680 2008-07-21 t.lainson threadkill,
715 e1df0680 2008-07-21 t.lainson threadkillgrp and threadpid are unimplemented.
716 e1df0680 2008-07-21 t.lainson .PP
717 058b0118 2005-01-03 devnull The implementation of
718 058b0118 2005-01-03 devnull .I threadnotify
719 058b0118 2005-01-03 devnull may not be correct.
720 33488b09 2005-03-18 devnull .PP
721 33488b09 2005-03-18 devnull There appears to be a race in the Linux NPTL
722 33488b09 2005-03-18 devnull implementation of
723 33488b09 2005-03-18 devnull .I pthread_exit .
724 33488b09 2005-03-18 devnull Call
725 33488b09 2005-03-18 devnull .I threadexitsall
726 33488b09 2005-03-18 devnull rather than coordinating a simultaneous
727 33488b09 2005-03-18 devnull .I threadexits
728 33488b09 2005-03-18 devnull among many threads.