1*df7d7638SFelix Johnson.\" Copyright (c) 2021 Felix Johnson <felix.the.red@gmail.com> 2*df7d7638SFelix Johnson.\" 3*df7d7638SFelix Johnson.\" Redistribution and use in source and binary forms, with or without 4*df7d7638SFelix Johnson.\" modification, are permitted provided that the following conditions 5*df7d7638SFelix Johnson.\" are met: 6*df7d7638SFelix Johnson.\" 1. Redistributions of source code must retain the above copyright 7*df7d7638SFelix Johnson.\" notice, this list of conditions and the following disclaimer. 8*df7d7638SFelix Johnson.\" 2. Redistributions in binary form must reproduce the above copyright 9*df7d7638SFelix Johnson.\" notice, this list of conditions and the following disclaimer in the 10*df7d7638SFelix Johnson.\" documentation and/or other materials provided with the distribution. 11*df7d7638SFelix Johnson.\" 12*df7d7638SFelix Johnson.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 13*df7d7638SFelix Johnson.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 14*df7d7638SFelix Johnson.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 15*df7d7638SFelix Johnson.\" PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 16*df7d7638SFelix Johnson.\" HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 17*df7d7638SFelix Johnson.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 18*df7d7638SFelix Johnson.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19*df7d7638SFelix Johnson.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20*df7d7638SFelix Johnson.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21*df7d7638SFelix Johnson.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22*df7d7638SFelix Johnson.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23*df7d7638SFelix Johnson.\" 24*df7d7638SFelix Johnson.Dd October 12, 2021 25*df7d7638SFelix Johnson.Dt PTHREAD_NP 3 26*df7d7638SFelix Johnson.Os 27*df7d7638SFelix Johnson.Sh NAME 28*df7d7638SFelix Johnson.Nm pthread_np 29*df7d7638SFelix Johnson.Nd FreeBSD extensions to POSIX thread functions 30*df7d7638SFelix Johnson.Sh LIBRARY 31*df7d7638SFelix Johnson.Lb libpthread 32*df7d7638SFelix Johnson.Sh SYNOPSIS 33*df7d7638SFelix Johnson.In pthread_np.h 34*df7d7638SFelix Johnson.Sh DESCRIPTION 35*df7d7638SFelix JohnsonThis manual page documents extensions to the POSIX thread functions. 36*df7d7638SFelix JohnsonThese extensions may or may not be portable to other operating systems. 37*df7d7638SFelix Johnson.Pp 38*df7d7638SFelix JohnsonThe POSIX thread functions are summarized in this section in the following 39*df7d7638SFelix Johnsongroups: 40*df7d7638SFelix Johnson.Pp 41*df7d7638SFelix Johnson.Bl -bullet -offset indent -compact 42*df7d7638SFelix Johnson.It 43*df7d7638SFelix JohnsonThread Routines 44*df7d7638SFelix Johnson.It 45*df7d7638SFelix JohnsonAttribute Object Routines 46*df7d7638SFelix Johnson.It 47*df7d7638SFelix JohnsonMutex Routines 48*df7d7638SFelix Johnson.El 49*df7d7638SFelix Johnson.\" .It 50*df7d7638SFelix Johnson.\" Condition Variable Routines 51*df7d7638SFelix Johnson.\" .It 52*df7d7638SFelix Johnson.\" Read/Write Lock Routines 53*df7d7638SFelix Johnson.\" .It 54*df7d7638SFelix Johnson.\" Per-Thread Context Routines 55*df7d7638SFelix Johnson.\" .It 56*df7d7638SFelix Johnson.\" Cleanup Routines 57*df7d7638SFelix Johnson.Ss Thread Routines 58*df7d7638SFelix Johnson.Bl -tag -width indent 59*df7d7638SFelix Johnson.It Xo 60*df7d7638SFelix Johnson.Ft int 61*df7d7638SFelix Johnson.Fo pthread_getaffinity_np 62*df7d7638SFelix Johnson.Fa "pthread_t td" "size_t cpusetsize" "cpuset_t *cpusetp" 63*df7d7638SFelix Johnson.Fc 64*df7d7638SFelix Johnson.Xc 65*df7d7638SFelix JohnsonGet the CPU affinity of a specified thread. 66*df7d7638SFelix Johnson.It Xo 67*df7d7638SFelix Johnson.Ft int 68*df7d7638SFelix Johnson.Fn pthread_get_name_np "pthread_t thread" "char *name" "size_t len" 69*df7d7638SFelix Johnson.Xc 70*df7d7638SFelix JohnsonGet the name of a specified thread. 71*df7d7638SFelix Johnson.It Xo 72*df7d7638SFelix Johnson.Ft int 73*df7d7638SFelix Johnson.Fn pthread_getname_np "pthread_t thread" "char *name" "size_t len" 74*df7d7638SFelix Johnson.Xc 75*df7d7638SFelix JohnsonGet the name of a specified thread. 76*df7d7638SFelix Johnson.It Xo 77*df7d7638SFelix Johnson.Ft int 78*df7d7638SFelix Johnson.Fn pthread_getthreadid_np void 79*df7d7638SFelix Johnson.Xc 80*df7d7638SFelix JohnsonGet the calling thread's integral ID. 81*df7d7638SFelix Johnson.It Xo 82*df7d7638SFelix Johnson.Ft int 83*df7d7638SFelix Johnson.Fn pthread_main_np void 84*df7d7638SFelix Johnson.Xc 85*df7d7638SFelix JohnsonIdentify the initial thread. 86*df7d7638SFelix Johnson.It Xo 87*df7d7638SFelix Johnson.Ft int 88*df7d7638SFelix Johnson.Fn pthread_multi_np void 89*df7d7638SFelix Johnson.Xc 90*df7d7638SFelix JohnsonSets the thread's scheduling mode to multi-threaded. 91*df7d7638SFelix Johnson.It Xo 92*df7d7638SFelix Johnson.Ft int 93*df7d7638SFelix Johnson.Fn pthread_peekjoin_np "pthread_t thread" "void **value_ptr" 94*df7d7638SFelix Johnson.Xc 95*df7d7638SFelix JohnsonPeek into the exit status of a specified thread. 96*df7d7638SFelix Johnson.It Xo 97*df7d7638SFelix Johnson.Ft int 98*df7d7638SFelix Johnson.Fn pthread_resume_all_np void 99*df7d7638SFelix Johnson.Xc 100*df7d7638SFelix JohnsonResume all suspended threads. 101*df7d7638SFelix Johnson.It Xo 102*df7d7638SFelix Johnson.Ft int 103*df7d7638SFelix Johnson.Fo pthread_setaffinity_np 104*df7d7638SFelix Johnson.Fa "pthread_t td" "size_t cpusetsize" "const cpuset_t *cpusetp" 105*df7d7638SFelix Johnson.Fc 106*df7d7638SFelix Johnson.Xc 107*df7d7638SFelix JohnsonSet the CPU affinity of a specified thread. 108*df7d7638SFelix Johnson.It Xo 109*df7d7638SFelix Johnson.Ft int 110*df7d7638SFelix Johnson.Fn pthread_set_name_np "pthread_t thread" "char *name" 111*df7d7638SFelix Johnson.Xc 112*df7d7638SFelix JohnsonSets the specified thread's name. 113*df7d7638SFelix Johnson.It Xo 114*df7d7638SFelix Johnson.Ft int 115*df7d7638SFelix Johnson.Fn pthread_setname_np "pthread_t thread" "char *name" 116*df7d7638SFelix Johnson.Xc 117*df7d7638SFelix JohnsonSets the specified thread's name. 118*df7d7638SFelix Johnson.It Xo 119*df7d7638SFelix Johnson.Ft int 120*df7d7638SFelix Johnson.Fn pthread_single_np void 121*df7d7638SFelix Johnson.Xc 122*df7d7638SFelix JohnsonSets the thread's scheduling mode to single-threaded. 123*df7d7638SFelix Johnson.It Xo 124*df7d7638SFelix Johnson.Ft int 125*df7d7638SFelix Johnson.Fn pthread_suspend_np "pthread_t tid" 126*df7d7638SFelix Johnson.Xc 127*df7d7638SFelix JohnsonSuspend the specified thread. 128*df7d7638SFelix Johnson.It Xo 129*df7d7638SFelix Johnson.Ft int 130*df7d7638SFelix Johnson.Fn pthread_suspend_all_np void 131*df7d7638SFelix Johnson.Xc 132*df7d7638SFelix JohnsonSuspend all active threads. 133*df7d7638SFelix Johnson.It Xo 134*df7d7638SFelix Johnson.Ft int 135*df7d7638SFelix Johnson.Fn pthread_switch_add_np "pthread_switch_routine_t routine" 136*df7d7638SFelix Johnson.Xc 137*df7d7638SFelix JohnsonInstall a routine that is called every time a thread context switches. 138*df7d7638SFelix Johnson.It Xo 139*df7d7638SFelix Johnson.Ft int 140*df7d7638SFelix Johnson.Fn pthread_switch_delete_np "pthread_switch_routine_t routine" 141*df7d7638SFelix Johnson.Xc 142*df7d7638SFelix JohnsonRemove a routine that is called every time a thread context switches. 143*df7d7638SFelix Johnson.It Xo 144*df7d7638SFelix Johnson.Ft int 145*df7d7638SFelix Johnson.Fo pthread_timedjoin_np 146*df7d7638SFelix Johnson.Fa "pthread_t thread" "void **value_ptr" "const struct timespec *abstime" 147*df7d7638SFelix Johnson.Fc 148*df7d7638SFelix Johnson.Xc 149*df7d7638SFelix JohnsonA variant of 150*df7d7638SFelix Johnson.Fn pthread_join 151*df7d7638SFelix Johnsonwith a timeout. 152*df7d7638SFelix Johnson.El 153*df7d7638SFelix Johnson.Ss Attribute Object Routines 154*df7d7638SFelix Johnson.Bl -tag -width indent 155*df7d7638SFelix Johnson.It Xo 156*df7d7638SFelix Johnson.Ft int 157*df7d7638SFelix Johnson.Fo pthread_attr_get_np 158*df7d7638SFelix Johnson.Fa "pthread_t pid" "pthread_attr_t *dst" 159*df7d7638SFelix Johnson.Fc 160*df7d7638SFelix Johnson.Xc 161*df7d7638SFelix JohnsonGet the attributes of an existent thread. 162*df7d7638SFelix Johnson.It Xo 163*df7d7638SFelix Johnson.Ft int 164*df7d7638SFelix Johnson.Fo pthread_attr_getaffinity_np 165*df7d7638SFelix Johnson.Fa "const pthread_attr_t *pattr" "size_t cpusetsize" "cpuset_t *cpusetp" 166*df7d7638SFelix Johnson.Fc 167*df7d7638SFelix Johnson.Xc 168*df7d7638SFelix JohnsonGet the CPU affinity mask from the thread attribute object. 169*df7d7638SFelix Johnson.It Xo 170*df7d7638SFelix Johnson.Ft int 171*df7d7638SFelix Johnson.Fo pthread_attr_setaffinity_np 172*df7d7638SFelix Johnson.Fa "pthread_attr_t *pattr" "size_t cpusetsize" "const cpuset_t *cpusetp" 173*df7d7638SFelix Johnson.Fc 174*df7d7638SFelix Johnson.Xc 175*df7d7638SFelix JohnsonSet the CPU affinity mask for the thread attribute object. 176*df7d7638SFelix Johnson.It Xo 177*df7d7638SFelix Johnson.Ft int 178*df7d7638SFelix Johnson.Fn pthread_attr_setcreatesuspend_np "pthread_attr_t *attr" 179*df7d7638SFelix Johnson.Xc 180*df7d7638SFelix JohnsonPermit creation of suspended threads. 181*df7d7638SFelix Johnson.El 182*df7d7638SFelix Johnson.Ss Mutex Routines 183*df7d7638SFelix Johnson.Bl -tag -width indent 184*df7d7638SFelix Johnson.It Xo 185*df7d7638SFelix Johnson.Ft int 186*df7d7638SFelix Johnson.Fn pthread_mutexattr_getkind_np "pthread_mutexattr_t attr" 187*df7d7638SFelix Johnson.Xc 188*df7d7638SFelix JohnsonDeprecated, use 189*df7d7638SFelix Johnson.Xr pthread_mutexattr_gettype 3 190*df7d7638SFelix Johnsoninstead. 191*df7d7638SFelix Johnson.It Xo 192*df7d7638SFelix Johnson.Ft int 193*df7d7638SFelix Johnson.Fn pthread_mutexattr_setkind_np "pthread_mutexattr_t *attr" 194*df7d7638SFelix Johnson.Xc 195*df7d7638SFelix JohnsonDeprecated, use 196*df7d7638SFelix Johnson.Xr pthread_mutexattr_settype 3 197*df7d7638SFelix Johnsoninstead. 198*df7d7638SFelix Johnson.El 199*df7d7638SFelix Johnson.\" .Ss Condition Variable Routines 200*df7d7638SFelix Johnson.\" .Bl -tag -width indent 201*df7d7638SFelix Johnson.\" .El 202*df7d7638SFelix Johnson.\" .Ss Read/Write Lock Routines 203*df7d7638SFelix Johnson.\" .Bl -tag -width indent 204*df7d7638SFelix Johnson.\" .El 205*df7d7638SFelix Johnson.\" .Ss Per-Thread Context Routines 206*df7d7638SFelix Johnson.\" .Bl -tag -width indent 207*df7d7638SFelix Johnson.\" .El 208*df7d7638SFelix Johnson.\" .Ss Cleanup Routines 209*df7d7638SFelix Johnson.\" .Bl -tag -width indent 210*df7d7638SFelix Johnson.\" .El 211*df7d7638SFelix Johnson.Sh SEE ALSO 212*df7d7638SFelix Johnson.Xr libthr 3 , 213*df7d7638SFelix Johnson.Xr pthread 3 , 214*df7d7638SFelix Johnson.Xr pthread_affinity_np 3 , 215*df7d7638SFelix Johnson.Xr pthread_attr_affinity_np 3 , 216*df7d7638SFelix Johnson.Xr pthread_attr_get_np 3 , 217*df7d7638SFelix Johnson.Xr pthread_attr_setcreatesuspend_np 3 , 218*df7d7638SFelix Johnson.Xr pthread_getthreadid_np 3 , 219*df7d7638SFelix Johnson.Xr pthread_join 3 , 220*df7d7638SFelix Johnson.Xr pthread_main_np 3 , 221*df7d7638SFelix Johnson.Xr pthread_multi_np 3 , 222*df7d7638SFelix Johnson.Xr pthread_mutexattr_getkind_np 3 , 223*df7d7638SFelix Johnson.Xr pthread_resume_all_np 3 , 224*df7d7638SFelix Johnson.Xr pthread_resume_np 3 , 225*df7d7638SFelix Johnson.Xr pthread_set_name_np 3 , 226*df7d7638SFelix Johnson.Xr pthread_suspend_all_np 3 , 227*df7d7638SFelix Johnson.Xr pthread_suspend_np 3 , 228*df7d7638SFelix Johnson.Xr pthread_switch_add_np 3 229*df7d7638SFelix Johnson.Sh STANDARDS 230*df7d7638SFelix JohnsonAll of these functions are non-portable extensions to POSIX threads. 231