Lines 30-36
Link Here
|
30 |
.\" |
30 |
.\" |
31 |
.\" $FreeBSD$ |
31 |
.\" $FreeBSD$ |
32 |
.\" |
32 |
.\" |
33 |
.Dd August 17, 2018 |
33 |
.Dd September 23, 2021 |
34 |
.Dt PTHREAD 3 |
34 |
.Dt PTHREAD 3 |
35 |
.Os |
35 |
.Os |
36 |
.Sh NAME |
36 |
.Sh NAME |
Lines 40-45
Link Here
|
40 |
.Lb libpthread |
40 |
.Lb libpthread |
41 |
.Sh SYNOPSIS |
41 |
.Sh SYNOPSIS |
42 |
.In pthread.h |
42 |
.In pthread.h |
|
|
43 |
.Pp |
44 |
When using functions ending in _np: |
45 |
.In pthread_np.h |
43 |
.Sh DESCRIPTION |
46 |
.Sh DESCRIPTION |
44 |
POSIX threads are a set of functions that support applications with |
47 |
POSIX threads are a set of functions that support applications with |
45 |
requirements for multiple flows of control, called |
48 |
requirements for multiple flows of control, called |
Lines 99-104
Compares two thread IDs.
Link Here
|
99 |
Terminates the calling thread. |
102 |
Terminates the calling thread. |
100 |
.It Xo |
103 |
.It Xo |
101 |
.Ft int |
104 |
.Ft int |
|
|
105 |
.Fn pthread_getaffinity_np "pthread_t td" "size_t cpusetsize" "cpuset_t *cpusetp" |
106 |
.Xc |
107 |
Get CPU affinity of a specified thread. |
108 |
.It Xo |
109 |
.Ft int |
110 |
.Fn pthread_get_name_np "pthread_t thread" "char *name" "size_t len" |
111 |
.Xc |
112 |
Get the name of a specified thread. |
113 |
.It Xo |
114 |
.Ft int |
115 |
.Fn pthread_getname_np "pthread_t thread" "char *name" "size_t len" |
116 |
.Xc |
117 |
Get the name of a specified thread. |
118 |
.It Xo |
119 |
.Ft int |
120 |
.Fn pthread_getthreadid_np void |
121 |
.Xc |
122 |
Get the calling thread's integral ID. |
123 |
.It Xo |
124 |
.Ft int |
102 |
.Fn pthread_join "pthread_t thread" "void **value_ptr" |
125 |
.Fn pthread_join "pthread_t thread" "void **value_ptr" |
103 |
.Xc |
126 |
.Xc |
104 |
Causes the calling thread to wait for the termination of the specified thread. |
127 |
Causes the calling thread to wait for the termination of the specified thread. |
Lines 109-124
Causes the calling thread to wait for the termination of the specified thread.
Link Here
|
109 |
Delivers a signal to a specified thread. |
132 |
Delivers a signal to a specified thread. |
110 |
.It Xo |
133 |
.It Xo |
111 |
.Ft int |
134 |
.Ft int |
|
|
135 |
.Fn pthread_main_np void |
136 |
.Xc |
137 |
Identify the initial thread. |
138 |
.It Xo |
139 |
.Ft int |
140 |
.Fn pthread_multi_np void |
141 |
.Xc |
142 |
Sets the thread's scheduling mode to multi-threaded. |
143 |
.It Xo |
144 |
.Ft int |
112 |
.Fn pthread_once "pthread_once_t *once_control" "void \*[lp]*init_routine\*[rp]\*[lp]void\*[rp]" |
145 |
.Fn pthread_once "pthread_once_t *once_control" "void \*[lp]*init_routine\*[rp]\*[lp]void\*[rp]" |
113 |
.Xc |
146 |
.Xc |
114 |
Calls an initialization routine once. |
147 |
Calls an initialization routine once. |
115 |
.It Xo |
148 |
.It Xo |
|
|
149 |
.Ft int |
150 |
.Fn pthread_peekjoin_np "pthread_t thread" "void **value_ptr" |
151 |
.Xc |
152 |
Peek into the exit status of a specified thread. |
153 |
.It Xo |
154 |
.Ft int |
155 |
.Fn pthread_resume_all_np void |
156 |
.Xc |
157 |
Resume all suspended threads. |
158 |
.It Xo |
116 |
.Ft pthread_t |
159 |
.Ft pthread_t |
117 |
.Fn pthread_self void |
160 |
.Fn pthread_self void |
118 |
.Xc |
161 |
.Xc |
119 |
Returns the thread ID of the calling thread. |
162 |
Returns the thread ID of the calling thread. |
120 |
.It Xo |
163 |
.It Xo |
121 |
.Ft int |
164 |
.Ft int |
|
|
165 |
.Fn pthread_setaffinity_np "pthread_t td" "size_t cpusetsize" "const cpuset_t *cpusetp" |
166 |
.Xc |
167 |
Attempt to set the CPU affinity of a specified thread. |
168 |
.It Xo |
169 |
.Ft int |
122 |
.Fn pthread_setcancelstate "int state" "int *oldstate" |
170 |
.Fn pthread_setcancelstate "int state" "int *oldstate" |
123 |
.Xc |
171 |
.Xc |
124 |
Sets the current thread's cancelability state. |
172 |
Sets the current thread's cancelability state. |
Lines 128-138
Sets the current thread's cancelability state.
Link Here
|
128 |
.Xc |
176 |
.Xc |
129 |
Sets the current thread's cancelability type. |
177 |
Sets the current thread's cancelability type. |
130 |
.It Xo |
178 |
.It Xo |
|
|
179 |
.Ft int |
180 |
.Fn pthread_set_name_np "pthread_t thread" "char *name" |
181 |
.Xc |
182 |
Sets the specified thread's name. |
183 |
.It Xo |
184 |
.Ft int |
185 |
.Fn pthread_setname_np "pthread_t thread" "char *name" |
186 |
.Xc |
187 |
Sets the specified thread's name. |
188 |
.It Xo |
189 |
.Ft int |
190 |
.Fn pthread_single_np void |
191 |
.Xc |
192 |
Sets the thread's scheduling mode to single-threaded. |
193 |
.It Xo |
194 |
.Ft int |
195 |
.Fn pthread_suspend_np "pthread_t tid" |
196 |
.Xc |
197 |
Suspend the specified thread. |
198 |
.It Xo |
199 |
.Ft int |
200 |
.Fn pthread_suspend_all_np void |
201 |
.Xc |
202 |
Suspend all active threads. |
203 |
.It Xo |
204 |
.Ft int |
205 |
.Fn pthread_switch_add_np "pthread_switch_routine_t routine" |
206 |
.Xc |
207 |
Install a routine to get called every time a thread |
208 |
gets the context switched. |
209 |
.It Xo |
210 |
.Ft int |
211 |
.Fn pthread_switch_delete_np "pthread_switch_routine_t routine" |
212 |
.Xc |
213 |
Remove a routine to get called every time a thread |
214 |
gets the context switched. |
215 |
.It Xo |
131 |
.Ft void |
216 |
.Ft void |
132 |
.Fn pthread_testcancel void |
217 |
.Fn pthread_testcancel void |
133 |
.Xc |
218 |
.Xc |
134 |
Creates a cancellation point in the calling thread. |
219 |
Creates a cancellation point in the calling thread. |
135 |
.It Xo |
220 |
.It Xo |
|
|
221 |
.Ft int |
222 |
.Fn pthread_timedjoin_np "pthread_t thread" "void **value_ptr" "const struct timespec *abstime) |
223 |
.Xc |
224 |
Equivalent to |
225 |
.Fn pthread_join |
226 |
except it will return if the specified thread does not exit before |
227 |
.Fa abstime |
228 |
passes. |
229 |
.It Xo |
136 |
.Ft void |
230 |
.Ft void |
137 |
.Fn pthread_yield void |
231 |
.Fn pthread_yield void |
138 |
.Xc |
232 |
.Xc |
Lines 147-152
Allows the scheduler to run another thread instead of the current one.
Link Here
|
147 |
Destroy a thread attributes object. |
241 |
Destroy a thread attributes object. |
148 |
.It Xo |
242 |
.It Xo |
149 |
.Ft int |
243 |
.Ft int |
|
|
244 |
.Fo pthread_attr_get_np |
245 |
.Fa "pthread_t pid" "pthread_attr_t *dst" |
246 |
.Fc |
247 |
.Xc |
248 |
Get the attributes of an existent thread. |
249 |
.It Xo |
250 |
.Ft int |
251 |
.Fo pthread_attr_getaffinity_np |
252 |
.Fa "const pthread_attr_t *pattr" "size_t cpusetsize" "cpuset_t *cpusetp" |
253 |
.Fc |
254 |
.Xc |
255 |
Get the CPU affinity mask from the thread attribute object. |
256 |
.It Xo |
257 |
.Ft int |
150 |
.Fo pthread_attr_getinheritsched |
258 |
.Fo pthread_attr_getinheritsched |
151 |
.Fa "const pthread_attr_t *attr" "int *inheritsched" |
259 |
.Fa "const pthread_attr_t *attr" "int *inheritsched" |
152 |
.Fc |
260 |
.Fc |
Lines 191-201
Get the detach state attribute from a thread attributes object.
Link Here
|
191 |
Initialize a thread attributes object with default values. |
299 |
Initialize a thread attributes object with default values. |
192 |
.It Xo |
300 |
.It Xo |
193 |
.Ft int |
301 |
.Ft int |
|
|
302 |
.Fn pthread_attr_setaffinity_np "pthread_attr_t *pattr" "size_t cpusetsize" "const cpuset_t *cpusetp" |
303 |
.Xc |
304 |
Set the CPU affinity mask for the thread attribute object. |
305 |
.It Xo |
306 |
.Ft int |
194 |
.Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched" |
307 |
.Fn pthread_attr_setinheritsched "pthread_attr_t *attr" "int inheritsched" |
195 |
.Xc |
308 |
.Xc |
196 |
Set the inherit scheduling attribute in a thread attributes object. |
309 |
Set the inherit scheduling attribute in a thread attributes object. |
197 |
.It Xo |
310 |
.It Xo |
198 |
.Ft int |
311 |
.Ft int |
|
|
312 |
.Fn pthread_attr_setcreatesuspend_np "pthread_attr_t *attr" |
313 |
.Xc |
314 |
Prepare thread attribute object for creation of suspended thread. |
315 |
.It Xo |
316 |
.Ft int |
199 |
.Fo pthread_attr_setschedparam |
317 |
.Fo pthread_attr_setschedparam |
200 |
.Fa "pthread_attr_t *attr" "const struct sched_param *param" |
318 |
.Fa "pthread_attr_t *attr" "const struct sched_param *param" |
201 |
.Fc |
319 |
.Fc |
Lines 236-241
Set the detach state in a thread attributes object.
Link Here
|
236 |
Destroy a mutex attributes object. |
354 |
Destroy a mutex attributes object. |
237 |
.It Xo |
355 |
.It Xo |
238 |
.Ft int |
356 |
.Ft int |
|
|
357 |
.Fn pthread_mutexattr_getkind_np "pthread_mutexattr_t attr" |
358 |
.Xc |
359 |
Deprecated, use |
360 |
.Xr pthread_mutexattr_gettype 3 |
361 |
instead. |
362 |
.It Xo |
363 |
.Ft int |
239 |
.Fn pthread_mutexattr_getprioceiling "const pthread_mutexattr_t *restrict attr" "int *restrict ceiling" |
364 |
.Fn pthread_mutexattr_getprioceiling "const pthread_mutexattr_t *restrict attr" "int *restrict ceiling" |
240 |
.Xc |
365 |
.Xc |
241 |
Obtain priority ceiling attribute of mutex attribute object. |
366 |
Obtain priority ceiling attribute of mutex attribute object. |
Lines 256-261
Obtain the mutex type attribute in the specified mutex attributes object.
Link Here
|
256 |
Initialize a mutex attributes object with default values. |
381 |
Initialize a mutex attributes object with default values. |
257 |
.It Xo |
382 |
.It Xo |
258 |
.Ft int |
383 |
.Ft int |
|
|
384 |
.Fn pthread_mutexattr_setkind_np "pthread_mutexattr_t *attr" |
385 |
.Xc |
386 |
Deprecated, use |
387 |
.Xr pthread_mutexattr_settype 3 |
388 |
instead. |
389 |
.It Xo |
390 |
.Ft int |
259 |
.Fn pthread_mutexattr_setprioceiling "pthread_mutexattr_t *attr" "int ceiling" |
391 |
.Fn pthread_mutexattr_setprioceiling "pthread_mutexattr_t *attr" "int ceiling" |
260 |
.Xc |
392 |
.Xc |
261 |
Set priority ceiling attribute of mutex attribute object. |
393 |
Set priority ceiling attribute of mutex attribute object. |
Lines 481-486
Threaded applications are linked with this library.
Link Here
|
481 |
.Xr pthread_affinity_np 3 , |
613 |
.Xr pthread_affinity_np 3 , |
482 |
.Xr pthread_atfork 3 , |
614 |
.Xr pthread_atfork 3 , |
483 |
.Xr pthread_attr 3 , |
615 |
.Xr pthread_attr 3 , |
|
|
616 |
.Xr pthread_attr_get_np 3 , |
617 |
.Xr pthread_attr_setcreatesuspend_np 3 , |
484 |
.Xr pthread_cancel 3 , |
618 |
.Xr pthread_cancel 3 , |
485 |
.Xr pthread_cleanup_pop 3 , |
619 |
.Xr pthread_cleanup_pop 3 , |
486 |
.Xr pthread_cleanup_push 3 , |
620 |
.Xr pthread_cleanup_push 3 , |
Lines 497-505
Threaded applications are linked with this library.
Link Here
|
497 |
.Xr pthread_equal 3 , |
631 |
.Xr pthread_equal 3 , |
498 |
.Xr pthread_exit 3 , |
632 |
.Xr pthread_exit 3 , |
499 |
.Xr pthread_getspecific 3 , |
633 |
.Xr pthread_getspecific 3 , |
|
|
634 |
.Xr pthread_getthreadid_np 3 , |
500 |
.Xr pthread_join 3 , |
635 |
.Xr pthread_join 3 , |
501 |
.Xr pthread_key_delete 3 , |
636 |
.Xr pthread_key_delete 3 , |
502 |
.Xr pthread_kill 3 , |
637 |
.Xr pthread_kill 3 , |
|
|
638 |
.Xr pthread_main_np 3 , |
639 |
.Xr pthread_multi_np 3 , |
503 |
.Xr pthread_mutex_destroy 3 , |
640 |
.Xr pthread_mutex_destroy 3 , |
504 |
.Xr pthread_mutex_init 3 , |
641 |
.Xr pthread_mutex_init 3 , |
505 |
.Xr pthread_mutex_lock 3 , |
642 |
.Xr pthread_mutex_lock 3 , |
Lines 508-519
Threaded applications are linked with this library.
Link Here
|
508 |
.Xr pthread_mutexattr_destroy 3 , |
645 |
.Xr pthread_mutexattr_destroy 3 , |
509 |
.Xr pthread_mutexattr_getprioceiling 3 , |
646 |
.Xr pthread_mutexattr_getprioceiling 3 , |
510 |
.Xr pthread_mutexattr_getprotocol 3 , |
647 |
.Xr pthread_mutexattr_getprotocol 3 , |
|
|
648 |
.Xr pthread_mutexattr_getkind_np 3 , |
511 |
.Xr pthread_mutexattr_gettype 3 , |
649 |
.Xr pthread_mutexattr_gettype 3 , |
512 |
.Xr pthread_mutexattr_init 3 , |
650 |
.Xr pthread_mutexattr_init 3 , |
513 |
.Xr pthread_mutexattr_setprioceiling 3 , |
651 |
.Xr pthread_mutexattr_setprioceiling 3 , |
514 |
.Xr pthread_mutexattr_setprotocol 3 , |
652 |
.Xr pthread_mutexattr_setprotocol 3 , |
515 |
.Xr pthread_mutexattr_settype 3 , |
653 |
.Xr pthread_mutexattr_settype 3 , |
516 |
.Xr pthread_once 3 , |
654 |
.Xr pthread_once 3 , |
|
|
655 |
.Xr pthread_resume_all_np 3 , |
517 |
.Xr pthread_rwlock_destroy 3 , |
656 |
.Xr pthread_rwlock_destroy 3 , |
518 |
.Xr pthread_rwlock_init 3 , |
657 |
.Xr pthread_rwlock_init 3 , |
519 |
.Xr pthread_rwlock_rdlock 3 , |
658 |
.Xr pthread_rwlock_rdlock 3 , |
Lines 526-532
Threaded applications are linked with this library.
Link Here
|
526 |
.Xr pthread_self 3 , |
665 |
.Xr pthread_self 3 , |
527 |
.Xr pthread_setcancelstate 3 , |
666 |
.Xr pthread_setcancelstate 3 , |
528 |
.Xr pthread_setcanceltype 3 , |
667 |
.Xr pthread_setcanceltype 3 , |
|
|
668 |
.Xr pthread_set_name_np 3 , |
529 |
.Xr pthread_setspecific 3 , |
669 |
.Xr pthread_setspecific 3 , |
|
|
670 |
.Xr pthread_suspend_np 3 , |
671 |
.Xr pthread_suspend_all_np 3 , |
672 |
.Xr pthread_switch_add_np 3 , |
530 |
.Xr pthread_testcancel 3 |
673 |
.Xr pthread_testcancel 3 |
531 |
.Sh STANDARDS |
674 |
.Sh STANDARDS |
532 |
The functions with the |
675 |
The functions with the |