1 .\" Copyright (c) 2021 Felix Johnson <felix.the.red@gmail.com>
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
6 .\" 1. Redistributions of source code must retain the above copyright
7 .\" notice, this list of conditions and the following disclaimer.
8 .\" 2. Redistributions in binary form must reproduce the above copyright
9 .\" notice, this list of conditions and the following disclaimer in the
10 .\" documentation and/or other materials provided with the distribution.
12 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
14 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
15 .\" PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16 .\" HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18 .\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22 .\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 .Nd FreeBSD extensions to POSIX thread functions
35 This manual page documents extensions to the POSIX thread functions.
36 These extensions may or may not be portable to other operating systems.
38 The POSIX thread functions are summarized in this section in the following
41 .Bl -bullet -offset indent -compact
45 Attribute Object Routines
50 .\" Condition Variable Routines
52 .\" Read/Write Lock Routines
54 .\" Per-Thread Context Routines
58 .Bl -tag -width indent
61 .Fo pthread_getaffinity_np
62 .Fa "pthread_t td" "size_t cpusetsize" "cpuset_t *cpusetp"
65 Get the CPU affinity of a specified thread.
68 .Fn pthread_get_name_np "pthread_t thread" "char *name" "size_t len"
70 Get the name of a specified thread.
73 .Fn pthread_getname_np "pthread_t thread" "char *name" "size_t len"
75 Get the name of a specified thread.
78 .Fn pthread_getthreadid_np void
80 Get the calling thread's integral ID.
83 .Fn pthread_main_np void
85 Identify the initial thread.
88 .Fn pthread_multi_np void
90 Sets the thread's scheduling mode to multi-threaded.
93 .Fn pthread_peekjoin_np "pthread_t thread" "void **value_ptr"
95 Peek into the exit status of a specified thread.
98 .Fn pthread_resume_all_np void
100 Resume all suspended threads.
103 .Fo pthread_setaffinity_np
104 .Fa "pthread_t td" "size_t cpusetsize" "const cpuset_t *cpusetp"
107 Set the CPU affinity of a specified thread.
110 .Fn pthread_set_name_np "pthread_t thread" "char *name"
112 Sets the specified thread's name.
115 .Fn pthread_setname_np "pthread_t thread" "char *name"
117 Sets the specified thread's name.
120 .Fn pthread_single_np void
122 Sets the thread's scheduling mode to single-threaded.
125 .Fn pthread_suspend_np "pthread_t tid"
127 Suspend the specified thread.
130 .Fn pthread_suspend_all_np void
132 Suspend all active threads.
135 .Fn pthread_switch_add_np "pthread_switch_routine_t routine"
137 Install a routine that is called every time a thread context switches.
140 .Fn pthread_switch_delete_np "pthread_switch_routine_t routine"
142 Remove a routine that is called every time a thread context switches.
145 .Fo pthread_timedjoin_np
146 .Fa "pthread_t thread" "void **value_ptr" "const struct timespec *abstime"
153 .Ss Attribute Object Routines
154 .Bl -tag -width indent
157 .Fo pthread_attr_get_np
158 .Fa "pthread_t pid" "pthread_attr_t *dst"
161 Get the attributes of an existent thread.
164 .Fo pthread_attr_getaffinity_np
165 .Fa "const pthread_attr_t *pattr" "size_t cpusetsize" "cpuset_t *cpusetp"
168 Get the CPU affinity mask from the thread attribute object.
171 .Fo pthread_attr_setaffinity_np
172 .Fa "pthread_attr_t *pattr" "size_t cpusetsize" "const cpuset_t *cpusetp"
175 Set the CPU affinity mask for the thread attribute object.
178 .Fn pthread_attr_setcreatesuspend_np "pthread_attr_t *attr"
180 Permit creation of suspended threads.
183 .Bl -tag -width indent
186 .Fn pthread_mutexattr_getkind_np "pthread_mutexattr_t attr"
189 .Xr pthread_mutexattr_gettype 3
193 .Fn pthread_mutexattr_setkind_np "pthread_mutexattr_t *attr"
196 .Xr pthread_mutexattr_settype 3
199 .\" .Ss Condition Variable Routines
200 .\" .Bl -tag -width indent
202 .\" .Ss Read/Write Lock Routines
203 .\" .Bl -tag -width indent
205 .\" .Ss Per-Thread Context Routines
206 .\" .Bl -tag -width indent
208 .\" .Ss Cleanup Routines
209 .\" .Bl -tag -width indent
214 .Xr pthread_affinity_np 3 ,
215 .Xr pthread_attr_affinity_np 3 ,
216 .Xr pthread_attr_get_np 3 ,
217 .Xr pthread_attr_setcreatesuspend_np 3 ,
218 .Xr pthread_getthreadid_np 3 ,
220 .Xr pthread_main_np 3 ,
221 .Xr pthread_multi_np 3 ,
222 .Xr pthread_mutexattr_getkind_np 3 ,
223 .Xr pthread_resume_all_np 3 ,
224 .Xr pthread_resume_np 3 ,
225 .Xr pthread_set_name_np 3 ,
226 .Xr pthread_suspend_all_np 3 ,
227 .Xr pthread_suspend_np 3 ,
228 .Xr pthread_switch_add_np 3
230 All of these functions are non-portable extensions to POSIX threads.