xref: /freebsd/share/man/man3/pthread_np.3 (revision cb2887746f8b9dd4ad6b1e757cdc053a08b25a2e)
1.\" Copyright (c) 2021 Felix Johnson <felix.the.red@gmail.com>
2.\"
3.\" Redistribution and use in source and binary forms, with or without
4.\" modification, are permitted provided that the following conditions
5.\" are met:
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.
11.\"
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.
23.\"
24.Dd October 12, 2021
25.Dt PTHREAD_NP 3
26.Os
27.Sh NAME
28.Nm pthread_np
29.Nd FreeBSD extensions to POSIX thread functions
30.Sh LIBRARY
31.Lb libpthread
32.Sh SYNOPSIS
33.In pthread_np.h
34.Sh DESCRIPTION
35This manual page documents extensions to the POSIX thread functions.
36These extensions may or may not be portable to other operating systems.
37.Pp
38The POSIX thread functions are summarized in this section in the following
39groups:
40.Pp
41.Bl -bullet -offset indent -compact
42.It
43Thread Routines
44.It
45Attribute Object Routines
46.It
47Mutex Routines
48.El
49.\" .It
50.\" Condition Variable Routines
51.\" .It
52.\" Read/Write Lock Routines
53.\" .It
54.\" Per-Thread Context Routines
55.\" .It
56.\" Cleanup Routines
57.Ss Thread Routines
58.Bl -tag -width indent
59.It Xo
60.Ft int
61.Fo pthread_getaffinity_np
62.Fa "pthread_t td" "size_t cpusetsize" "cpuset_t *cpusetp"
63.Fc
64.Xc
65Get the CPU affinity of a specified thread.
66.It Xo
67.Ft int
68.Fn pthread_get_name_np "pthread_t thread" "char *name" "size_t len"
69.Xc
70Get the name of a specified thread.
71.It Xo
72.Ft int
73.Fn pthread_getname_np "pthread_t thread" "char *name" "size_t len"
74.Xc
75Get the name of a specified thread.
76.It Xo
77.Ft int
78.Fn pthread_getthreadid_np void
79.Xc
80Get the calling thread's integral ID.
81.It Xo
82.Ft int
83.Fn pthread_main_np void
84.Xc
85Identify the initial thread.
86.It Xo
87.Ft int
88.Fn pthread_multi_np void
89.Xc
90Sets the thread's scheduling mode to multi-threaded.
91.It Xo
92.Ft int
93.Fn pthread_peekjoin_np "pthread_t thread" "void **value_ptr"
94.Xc
95Peek into the exit status of a specified thread.
96.It Xo
97.Ft int
98.Fn pthread_resume_all_np void
99.Xc
100Resume all suspended threads.
101.It Xo
102.Ft int
103.Fo pthread_setaffinity_np
104.Fa "pthread_t td" "size_t cpusetsize" "const cpuset_t *cpusetp"
105.Fc
106.Xc
107Set the CPU affinity of a specified thread.
108.It Xo
109.Ft int
110.Fn pthread_set_name_np "pthread_t thread" "char *name"
111.Xc
112Sets the specified thread's name.
113.It Xo
114.Ft int
115.Fn pthread_setname_np "pthread_t thread" "char *name"
116.Xc
117Sets the specified thread's name.
118.It Xo
119.Ft void
120.Fn pthread_signals_block_np void
121.Xc
122Blocks all asynchronous signals, quickly.
123.It Xo
124.Ft int
125.Fn pthread_single_np void
126.Xc
127Sets the thread's scheduling mode to single-threaded.
128.It Xo
129.Ft int
130.Fn pthread_suspend_np "pthread_t tid"
131.Xc
132Suspend the specified thread.
133.It Xo
134.Ft int
135.Fn pthread_suspend_all_np void
136.Xc
137Suspend all active threads.
138.It Xo
139.Ft int
140.Fo pthread_timedjoin_np
141.Fa "pthread_t thread" "void **value_ptr" "const struct timespec *abstime"
142.Fc
143.Xc
144A variant of
145.Fn pthread_join
146with a timeout.
147.El
148.Ss Attribute Object Routines
149.Bl -tag -width indent
150.It Xo
151.Ft int
152.Fo pthread_attr_get_np
153.Fa "pthread_t pid" "pthread_attr_t *dst"
154.Fc
155.Xc
156Get the attributes of an existent thread.
157.It Xo
158.Ft int
159.Fo pthread_attr_getaffinity_np
160.Fa "const pthread_attr_t *pattr" "size_t cpusetsize" "cpuset_t *cpusetp"
161.Fc
162.Xc
163Get the CPU affinity mask from the thread attribute object.
164.It Xo
165.Ft int
166.Fo pthread_attr_setaffinity_np
167.Fa "pthread_attr_t *pattr" "size_t cpusetsize" "const cpuset_t *cpusetp"
168.Fc
169.Xc
170Set the CPU affinity mask for the thread attribute object.
171.It Xo
172.Ft int
173.Fn pthread_attr_setcreatesuspend_np "pthread_attr_t *attr"
174.Xc
175Permit creation of suspended threads.
176.El
177.Ss Mutex Routines
178.Bl -tag -width indent
179.It Xo
180.Ft int
181.Fn pthread_mutexattr_getkind_np "pthread_mutexattr_t attr"
182.Xc
183Deprecated, use
184.Xr pthread_mutexattr_gettype 3
185instead.
186.It Xo
187.Ft int
188.Fn pthread_mutexattr_setkind_np "pthread_mutexattr_t *attr"
189.Xc
190Deprecated, use
191.Xr pthread_mutexattr_settype 3
192instead.
193.El
194.\" .Ss Condition Variable Routines
195.\" .Bl -tag -width indent
196.\" .El
197.\" .Ss Read/Write Lock Routines
198.\" .Bl -tag -width indent
199.\" .El
200.\" .Ss Per-Thread Context Routines
201.\" .Bl -tag -width indent
202.\" .El
203.\" .Ss Cleanup Routines
204.\" .Bl -tag -width indent
205.\" .El
206.Sh SEE ALSO
207.Xr libthr 3 ,
208.Xr pthread 3 ,
209.Xr pthread_affinity_np 3 ,
210.Xr pthread_attr_affinity_np 3 ,
211.Xr pthread_attr_get_np 3 ,
212.Xr pthread_attr_setcreatesuspend_np 3 ,
213.Xr pthread_getthreadid_np 3 ,
214.Xr pthread_join 3 ,
215.Xr pthread_main_np 3 ,
216.Xr pthread_multi_np 3 ,
217.Xr pthread_mutexattr_getkind_np 3 ,
218.Xr pthread_resume_all_np 3 ,
219.Xr pthread_resume_np 3 ,
220.Xr pthread_set_name_np 3 ,
221.Xr pthread_signals_block_np 3 ,
222.Xr pthread_suspend_all_np 3 ,
223.Xr pthread_suspend_np 3 ,
224.Xr pthread_switch_add_np 3
225.Sh STANDARDS
226All of these functions are non-portable extensions to POSIX threads.
227