15335c6bcSRobert Watson.\" Copyright (c) 2005 Robert N. M. Watson 2*dab59af3SLi-Wen Hsu.\" Copyright (c) 2014,2015,2021 The FreeBSD Foundation 35335c6bcSRobert Watson.\" All rights reserved. 45335c6bcSRobert Watson.\" 52f02abc1SKonstantin Belousov.\" Part of this documentation was written by 62f02abc1SKonstantin Belousov.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship 72f02abc1SKonstantin Belousov.\" from the FreeBSD Foundation. 82f02abc1SKonstantin Belousov.\" 95335c6bcSRobert Watson.\" Redistribution and use in source and binary forms, with or without 105335c6bcSRobert Watson.\" modification, are permitted provided that the following conditions 115335c6bcSRobert Watson.\" are met: 125335c6bcSRobert Watson.\" 1. Redistributions of source code must retain the above copyright 135335c6bcSRobert Watson.\" notice, this list of conditions and the following disclaimer. 145335c6bcSRobert Watson.\" 2. Redistributions in binary form must reproduce the above copyright 155335c6bcSRobert Watson.\" notice, this list of conditions and the following disclaimer in the 165335c6bcSRobert Watson.\" documentation and/or other materials provided with the distribution. 175335c6bcSRobert Watson.\" 185335c6bcSRobert Watson.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 195335c6bcSRobert Watson.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 205335c6bcSRobert Watson.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 215335c6bcSRobert Watson.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 225335c6bcSRobert Watson.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 235335c6bcSRobert Watson.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 245335c6bcSRobert Watson.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 255335c6bcSRobert Watson.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 265335c6bcSRobert Watson.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 275335c6bcSRobert Watson.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 285335c6bcSRobert Watson.\" SUCH DAMAGE. 295335c6bcSRobert Watson.\" 30f5b97470SKonstantin Belousov.Dd October 1, 2021 315335c6bcSRobert Watson.Dt LIBTHR 3 32aa12cea2SUlrich Spörlein.Os 335335c6bcSRobert Watson.Sh NAME 345335c6bcSRobert Watson.Nm libthr 35886659feSRuslan Ermilov.Nd "1:1 POSIX threads library" 365335c6bcSRobert Watson.Sh LIBRARY 375335c6bcSRobert Watson.Lb libthr 385335c6bcSRobert Watson.Sh SYNOPSIS 395335c6bcSRobert Watson.In pthread.h 405335c6bcSRobert Watson.Sh DESCRIPTION 415335c6bcSRobert WatsonThe 425335c6bcSRobert Watson.Nm 43886659feSRuslan Ermilovlibrary provides a 1:1 implementation of the 445335c6bcSRobert Watson.Xr pthread 3 455335c6bcSRobert Watsonlibrary interfaces for application threading. 46886659feSRuslan ErmilovIt 475335c6bcSRobert Watsonhas been optimized for use by applications expecting system scope thread 4860404ec9SJilles Tjoelkersemantics. 492f02abc1SKonstantin Belousov.Pp 502f02abc1SKonstantin BelousovThe library is tightly integrated with the run-time link editor 512f02abc1SKonstantin Belousov.Xr ld-elf.so.1 1 522f02abc1SKonstantin Belousovand 532f02abc1SKonstantin Belousov.Lb libc ; 542f02abc1SKonstantin Belousovall three components must be built from the same source tree. 552f02abc1SKonstantin BelousovMixing 562f02abc1SKonstantin Belousov.Li libc 572f02abc1SKonstantin Belousovand 582f02abc1SKonstantin Belousov.Nm 592f02abc1SKonstantin Belousovlibraries from different versions of 602f02abc1SKonstantin Belousov.Fx 612f02abc1SKonstantin Belousovis not supported. 622f02abc1SKonstantin BelousovThe run-time linker 632f02abc1SKonstantin Belousov.Xr ld-elf.so.1 1 642f02abc1SKonstantin Belousovhas some code to ensure backward-compatibility with older versions of 652f02abc1SKonstantin Belousov.Nm . 662f02abc1SKonstantin Belousov.Pp 672f02abc1SKonstantin BelousovThe man page documents the quirks and tunables of the 682f02abc1SKonstantin Belousov.Nm . 692f02abc1SKonstantin BelousovWhen linking with 702f02abc1SKonstantin Belousov.Li -lpthread , 712f02abc1SKonstantin Belousovthe run-time dependency 722f02abc1SKonstantin Belousov.Li libthr.so.3 732f02abc1SKonstantin Belousovis recorded in the produced object. 742f02abc1SKonstantin Belousov.Sh MUTEX ACQUISITION 752f02abc1SKonstantin BelousovA locked mutex (see 762f02abc1SKonstantin Belousov.Xr pthread_mutex_lock 3 ) 772f02abc1SKonstantin Belousovis represented by a volatile variable of type 782f02abc1SKonstantin Belousov.Dv lwpid_t , 792f02abc1SKonstantin Belousovwhich records the global system identifier of the thread 802f02abc1SKonstantin Belousovowning the lock. 812f02abc1SKonstantin Belousov.Nm 822f02abc1SKonstantin Belousovperforms a contested mutex acquisition in three stages, each of which 832f02abc1SKonstantin Belousovis more resource-consuming than the previous. 84663222b9SSergey KandaurovThe first two stages are only applied for a mutex of 85663222b9SSergey Kandaurov.Dv PTHREAD_MUTEX_ADAPTIVE_NP 86663222b9SSergey Kandaurovtype and 87663222b9SSergey Kandaurov.Dv PTHREAD_PRIO_NONE 88663222b9SSergey Kandaurovprotocol (see 89663222b9SSergey Kandaurov.Xr pthread_mutexattr 3 ) . 902f02abc1SKonstantin Belousov.Pp 91663222b9SSergey KandaurovFirst, on SMP systems, a spin loop 922f02abc1SKonstantin Belousovis performed, where the library attempts to acquire the lock by 932f02abc1SKonstantin Belousov.Xr atomic 9 942f02abc1SKonstantin Belousovoperations. 952f02abc1SKonstantin BelousovThe loop count is controlled by the 962f02abc1SKonstantin Belousov.Ev LIBPTHREAD_SPINLOOPS 972f02abc1SKonstantin Belousovenvironment variable, with a default value of 2000. 982f02abc1SKonstantin Belousov.Pp 992f02abc1SKonstantin BelousovIf the spin loop 1002f02abc1SKonstantin Belousovwas unable to acquire the mutex, a yield loop 1012f02abc1SKonstantin Belousovis executed, performing the same 1022f02abc1SKonstantin Belousov.Xr atomic 9 1032f02abc1SKonstantin Belousovacquisition attempts as the spin loop, 1042f02abc1SKonstantin Belousovbut each attempt is followed by a yield of the CPU time 1052f02abc1SKonstantin Belousovof the thread using the 1062f02abc1SKonstantin Belousov.Xr sched_yield 2 1072f02abc1SKonstantin Belousovsyscall. 1082f02abc1SKonstantin BelousovBy default, the yield loop 1092f02abc1SKonstantin Belousovis not executed. 1102f02abc1SKonstantin BelousovThis is controlled by the 1112f02abc1SKonstantin Belousov.Ev LIBPTHREAD_YIELDLOOPS 1122f02abc1SKonstantin Belousovenvironment variable. 1132f02abc1SKonstantin Belousov.Pp 1142f02abc1SKonstantin BelousovIf both the spin and yield loops 1152f02abc1SKonstantin Belousovfailed to acquire the lock, the thread is taken off the CPU and 1162f02abc1SKonstantin Belousovput to sleep in the kernel with the 1174992013fSJilles Tjoelker.Xr _umtx_op 2 1182f02abc1SKonstantin Belousovsyscall. 1192f02abc1SKonstantin BelousovThe kernel wakes up a thread and hands the ownership of the lock to 1202f02abc1SKonstantin Belousovthe woken thread when the lock becomes available. 1212f02abc1SKonstantin Belousov.Sh THREAD STACKS 1222f02abc1SKonstantin BelousovEach thread is provided with a private user-mode stack area 1232f02abc1SKonstantin Belousovused by the C runtime. 1242f02abc1SKonstantin BelousovThe size of the main (initial) thread stack is set by the kernel, and is 1252f02abc1SKonstantin Belousovcontrolled by the 1262f02abc1SKonstantin Belousov.Dv RLIMIT_STACK 1272f02abc1SKonstantin Belousovprocess resource limit (see 1282f02abc1SKonstantin Belousov.Xr getrlimit 2 ) . 1292f02abc1SKonstantin Belousov.Pp 1302f02abc1SKonstantin BelousovBy default, the main thread's stack size is equal to the value of 1312f02abc1SKonstantin Belousov.Dv RLIMIT_STACK 1322f02abc1SKonstantin Belousovfor the process. 1332f02abc1SKonstantin BelousovIf the 1342f02abc1SKonstantin Belousov.Ev LIBPTHREAD_SPLITSTACK_MAIN 1352f02abc1SKonstantin Belousovenvironment variable is present in the process environment 1362f02abc1SKonstantin Belousov(its value does not matter), 1372f02abc1SKonstantin Belousovthe main thread's stack is reduced to 4MB on 64bit architectures, and to 1382f02abc1SKonstantin Belousov2MB on 32bit architectures, when the threading library is initialized. 1392f02abc1SKonstantin BelousovThe rest of the address space area which has been reserved by the 1402f02abc1SKonstantin Belousovkernel for the initial process stack is used for non-initial thread stacks 1412f02abc1SKonstantin Belousovin this case. 1422f02abc1SKonstantin BelousovThe presence of the 1432f02abc1SKonstantin Belousov.Ev LIBPTHREAD_BIGSTACK_MAIN 1442f02abc1SKonstantin Belousovenvironment variable overrides 1452f02abc1SKonstantin Belousov.Ev LIBPTHREAD_SPLITSTACK_MAIN ; 1462f02abc1SKonstantin Belousovit is kept for backward-compatibility. 1472f02abc1SKonstantin Belousov.Pp 1482f02abc1SKonstantin BelousovThe size of stacks for threads created by the process at run-time 1492f02abc1SKonstantin Belousovwith the 1502f02abc1SKonstantin Belousov.Xr pthread_create 3 1512f02abc1SKonstantin Belousovcall is controlled by thread attributes: see 1522f02abc1SKonstantin Belousov.Xr pthread_attr 3 , 1532f02abc1SKonstantin Belousovin particular, the 1542f02abc1SKonstantin Belousov.Xr pthread_attr_setstacksize 3 , 1552f02abc1SKonstantin Belousov.Xr pthread_attr_setguardsize 3 1562f02abc1SKonstantin Belousovand 1572f02abc1SKonstantin Belousov.Xr pthread_attr_setstackaddr 3 1582f02abc1SKonstantin Belousovfunctions. 1592f02abc1SKonstantin BelousovIf no attributes for the thread stack size are specified, the default 1602f02abc1SKonstantin Belousovnon-initial thread stack size is 2MB for 64bit architectures, and 1MB 1612f02abc1SKonstantin Belousovfor 32bit architectures. 1622f02abc1SKonstantin Belousov.Sh RUN-TIME SETTINGS 1632f02abc1SKonstantin BelousovThe following environment variables are recognized by 1642f02abc1SKonstantin Belousov.Nm 1652f02abc1SKonstantin Belousovand adjust the operation of the library at run-time: 16641ea34a2SKonstantin Belousov.Bl -tag -width "Ev LIBPTHREAD_SPLITSTACK_MAIN" 1672f02abc1SKonstantin Belousov.It Ev LIBPTHREAD_BIGSTACK_MAIN 1682f02abc1SKonstantin BelousovDisables the reduction of the initial thread stack enabled by 1692f02abc1SKonstantin Belousov.Ev LIBPTHREAD_SPLITSTACK_MAIN . 1702f02abc1SKonstantin Belousov.It Ev LIBPTHREAD_SPLITSTACK_MAIN 1712f02abc1SKonstantin BelousovCauses a reduction of the initial thread stack, as described in the 1722f02abc1SKonstantin Belousovsection 1732f02abc1SKonstantin Belousov.Sx THREAD STACKS . 1742f02abc1SKonstantin BelousovThis was the default behaviour of 1752f02abc1SKonstantin Belousov.Nm 1762f02abc1SKonstantin Belousovbefore 1772f02abc1SKonstantin Belousov.Fx 11.0 . 1782f02abc1SKonstantin Belousov.It Ev LIBPTHREAD_SPINLOOPS 1792f02abc1SKonstantin BelousovThe integer value of the variable overrides the default count of 1802f02abc1SKonstantin Belousoviterations in the 1812f02abc1SKonstantin Belousov.Li spin loop 1822f02abc1SKonstantin Belousovof the mutex acquisition. 1832f02abc1SKonstantin BelousovThe default count is 2000, set by the 1842f02abc1SKonstantin Belousov.Dv MUTEX_ADAPTIVE_SPINS 1852f02abc1SKonstantin Belousovconstant in the 1862f02abc1SKonstantin Belousov.Nm 1872f02abc1SKonstantin Belousovsources. 1882f02abc1SKonstantin Belousov.It Ev LIBPTHREAD_YIELDLOOPS 1892f02abc1SKonstantin BelousovA non-zero integer value enables the yield loop 1902f02abc1SKonstantin Belousovin the process of the mutex acquisition. 1912f02abc1SKonstantin BelousovThe value is the count of loop operations. 1922f02abc1SKonstantin Belousov.It Ev LIBPTHREAD_QUEUE_FIFO 1932f02abc1SKonstantin BelousovThe integer value of the variable specifies how often blocked 1942f02abc1SKonstantin Belousovthreads are inserted at the head of the sleep queue, instead of its tail. 1952f02abc1SKonstantin BelousovBigger values reduce the frequency of the FIFO discipline. 1962f02abc1SKonstantin BelousovThe value must be between 0 and 255. 19793ca6ff2SKonstantin Belousov.It Dv LIBPTHREAD_UMTX_MIN_TIMEOUT 19893ca6ff2SKonstantin BelousovThe minimal amount of time, in nanoseconds, the thread is required to sleep 19993ca6ff2SKonstantin Belousovfor pthread operations specifying a timeout. 20093ca6ff2SKonstantin BelousovIf the operation requests a timeout less than the value provided, 20193ca6ff2SKonstantin Belousovit is silently increased to the value. 20293ca6ff2SKonstantin BelousovThe value of zero means no minimum (default). 20341ea34a2SKonstantin Belousov.Pp 2042f02abc1SKonstantin Belousov.El 20541ea34a2SKonstantin BelousovThe following 20641ea34a2SKonstantin Belousov.Dv sysctl 20741ea34a2SKonstantin BelousovMIBs affect the operation of the library: 20841ea34a2SKonstantin Belousov.Bl -tag -width "Dv debug.umtx.robust_faults_verbose" 20941ea34a2SKonstantin Belousov.It Dv kern.ipc.umtx_vnode_persistent 21041ea34a2SKonstantin BelousovBy default, a shared lock backed by a mapped file in memory is 21141ea34a2SKonstantin Belousovautomatically destroyed on the last unmap of the corresponding file's page, 21241ea34a2SKonstantin Belousovwhich is allowed by POSIX. 21341ea34a2SKonstantin BelousovSetting the sysctl to 1 makes such a shared lock object persist until 21441ea34a2SKonstantin Belousovthe vnode is recycled by the Virtual File System. 21541ea34a2SKonstantin BelousovNote that in case file is not opened and not mapped, the kernel might 21641ea34a2SKonstantin Belousovrecycle it at any moment, making this sysctl less useful than it sounds. 21741ea34a2SKonstantin Belousov.It Dv kern.ipc.umtx_max_robust 21841ea34a2SKonstantin BelousovThe maximal number of robust mutexes allowed for one thread. 21941ea34a2SKonstantin BelousovThe kernel will not unlock more mutexes than specified, see 220a51584a2SGraham Percival.Xr _umtx_op 2 22141ea34a2SKonstantin Belousovfor more details. 22241ea34a2SKonstantin BelousovThe default value is large enough for most useful applications. 22341ea34a2SKonstantin Belousov.It Dv debug.umtx.robust_faults_verbose 22441ea34a2SKonstantin BelousovA non zero value makes kernel emit some diagnostic when the robust 22541ea34a2SKonstantin Belousovmutexes unlock was prematurely aborted after detecting some inconsistency, 22641ea34a2SKonstantin Belousovas a measure to prevent memory corruption. 22741ea34a2SKonstantin Belousov.El 22841ea34a2SKonstantin Belousov.Pp 22941ea34a2SKonstantin BelousovThe 23041ea34a2SKonstantin Belousov.Dv RLIMIT_UMTXP 23141ea34a2SKonstantin Belousovlimit (see 23241ea34a2SKonstantin Belousov.Xr getrlimit 2 ) 23341ea34a2SKonstantin Belousovdefines how many shared locks a given user may create simultaneously. 2342f02abc1SKonstantin Belousov.Sh INTERACTION WITH RUN-TIME LINKER 235e50def75SKonstantin BelousovOn load, 2362f02abc1SKonstantin Belousov.Nm 237e50def75SKonstantin Belousovinstalls interposing handlers into the hooks exported by 238e50def75SKonstantin Belousov.Li libc . 239e50def75SKonstantin BelousovThe interposers provide real locking implementation instead of the 240e50def75SKonstantin Belousovstubs for single-threaded processes in 2417d6906b8SKonstantin Belousov.Li libc , 242e50def75SKonstantin Belousovcancellation support and some modifications to the signal operations. 2432f02abc1SKonstantin Belousov.Pp 2442f02abc1SKonstantin Belousov.Nm 2452f02abc1SKonstantin Belousovcannot be unloaded; the 2462f02abc1SKonstantin Belousov.Xr dlclose 3 2472f02abc1SKonstantin Belousovfunction does not perform any action when called with a handle for 2482f02abc1SKonstantin Belousov.Nm . 249e50def75SKonstantin BelousovOne of the reasons is that the internal interposing of 2502f02abc1SKonstantin Belousov.Li libc 2512f02abc1SKonstantin Belousovfunctions cannot be undone. 2522f02abc1SKonstantin Belousov.Sh SIGNALS 253e50def75SKonstantin BelousovThe implementation interposes the user-installed 2542f02abc1SKonstantin Belousov.Xr signal 3 2552f02abc1SKonstantin Belousovhandlers. 2562f02abc1SKonstantin BelousovThis interposing is done to postpone signal delivery to threads which 2572f02abc1SKonstantin Belousoventered (libthr-internal) critical sections, where the calling 2582f02abc1SKonstantin Belousovof the user-provided signal handler is unsafe. 2592f02abc1SKonstantin BelousovAn example of such a situation is owning the internal library lock. 2602f02abc1SKonstantin BelousovWhen a signal is delivered while the signal handler cannot be safely 2612f02abc1SKonstantin Belousovcalled, the call is postponed and performed until after the exit from 2622f02abc1SKonstantin Belousovthe critical section. 2632f02abc1SKonstantin BelousovThis should be taken into account when interpreting 2642f02abc1SKonstantin Belousov.Xr ktrace 1 2652f02abc1SKonstantin Belousovlogs. 266f5b97470SKonstantin Belousov.Sh PROCESS-SHARED SYNCHRONIZATION OBJECTS 267f5b97470SKonstantin BelousovIn the 268f5b97470SKonstantin Belousov.Li libthr 269f5b97470SKonstantin Belousovimplementation, 270f5b97470SKonstantin Belousovuser-visible types for all synchronization objects (e.g. pthread_mutex_t) 271f5b97470SKonstantin Belousovare pointers to internal structures, allocated either by the corresponding 272f5b97470SKonstantin Belousov.Fn pthread_<objtype>_init 273f5b97470SKonstantin Belousovmethod call, or implicitly on first use when a static initializer 274f5b97470SKonstantin Belousovwas specified. 275f5b97470SKonstantin BelousovThe initial implementation of process-private locking object used this 276f5b97470SKonstantin Belousovmodel with internal allocation, and the addition of process-shared objects 277f5b97470SKonstantin Belousovwas done in a way that did not break the application binary interface. 278f5b97470SKonstantin Belousov.Pp 279f5b97470SKonstantin BelousovFor process-private objects, the internal structure is allocated using 280f5b97470SKonstantin Belousoveither 281f5b97470SKonstantin Belousov.Xr malloc 3 282f5b97470SKonstantin Belousovor, for 283f5b97470SKonstantin Belousov.Xr pthread_mutex_init 3 , 284f5b97470SKonstantin Belousovan internal memory allocator implemented in 285f5b97470SKonstantin Belousov.Nm . 286f5b97470SKonstantin BelousovThe internal allocator for mutexes is used to avoid bootstrap issues 287f5b97470SKonstantin Belousovwith many 288f5b97470SKonstantin Belousov.Xr malloc 3 289f5b97470SKonstantin Belousovimplementations which need working mutexes to function. 290f5b97470SKonstantin BelousovThe same allocator is used for thread-specific data, see 291f5b97470SKonstantin Belousov.Xr pthread_setspecific 3 , 292f5b97470SKonstantin Belousovfor the same reason. 293f5b97470SKonstantin Belousov.Pp 294f5b97470SKonstantin BelousovFor process-shared objects, the internal structure is created by first 295f5b97470SKonstantin Belousovallocating a shared memory segment using 296f5b97470SKonstantin Belousov.Xr _umtx_op 2 297f5b97470SKonstantin Belousovoperation 298f5b97470SKonstantin Belousov.Dv UMTX_OP_SHM , 299f5b97470SKonstantin Belousovand then mapping it into process address space with 300f5b97470SKonstantin Belousov.Xr mmap 2 301f5b97470SKonstantin Belousovwith the 302f5b97470SKonstantin Belousov.Dv MAP_SHARED 303f5b97470SKonstantin Belousovflag. 304f5b97470SKonstantin BelousovThe POSIX standard requires that: 305f5b97470SKonstantin Belousov.Bd -literal 306f5b97470SKonstantin Belousovonly the process-shared synchronization object itself can be used for 307f5b97470SKonstantin Belousovperforming synchronization. It need not be referenced at the address 308f5b97470SKonstantin Belousovused to initialize it (that is, another mapping of the same object can 309f5b97470SKonstantin Belousovbe used). 310f5b97470SKonstantin Belousov.Ed 311f5b97470SKonstantin Belousov.Pp 312f5b97470SKonstantin BelousovWith the 313f5b97470SKonstantin Belousov.Fx 314f5b97470SKonstantin Belousovimplementation, process-shared objects require initialization 315f5b97470SKonstantin Belousovin each process that use them. 316f5b97470SKonstantin BelousovIn particular, if you map the shared memory containing the user portion of 317f5b97470SKonstantin Belousova process-shared object already initialized in different process, locking 318f5b97470SKonstantin Belousovfunctions do not work on it. 319f5b97470SKonstantin Belousov.Pp 320f5b97470SKonstantin BelousovAnother broken case is a forked child creating the object in memory shared 321f5b97470SKonstantin Belousovwith the parent, which cannot be used from parent. 322f5b97470SKonstantin BelousovNote that processes should not use non-async-signal safe functions after 323f5b97470SKonstantin Belousov.Xr fork 2 324f5b97470SKonstantin Belousovanyway. 3255335c6bcSRobert Watson.Sh SEE ALSO 3262f02abc1SKonstantin Belousov.Xr ktrace 1 , 3272f02abc1SKonstantin Belousov.Xr ld-elf.so.1 1 , 3286e1fc011SGraham Percival.Xr _umtx_op 2 , 329be9430efSEdward Tomasz Napierala.Xr errno 2 , 3306e1fc011SGraham Percival.Xr getrlimit 2 , 33141ea34a2SKonstantin Belousov.Xr thr_exit 2 , 33241ea34a2SKonstantin Belousov.Xr thr_kill 2 , 33341ea34a2SKonstantin Belousov.Xr thr_kill2 2 , 33441ea34a2SKonstantin Belousov.Xr thr_new 2 , 33541ea34a2SKonstantin Belousov.Xr thr_self 2 , 33641ea34a2SKonstantin Belousov.Xr thr_set_name 2 , 3372f02abc1SKonstantin Belousov.Xr dlclose 3 , 3382f02abc1SKonstantin Belousov.Xr dlopen 3 , 3392f02abc1SKonstantin Belousov.Xr getenv 3 , 3402f02abc1SKonstantin Belousov.Xr pthread_attr 3 , 3412f02abc1SKonstantin Belousov.Xr pthread_attr_setstacksize 3 , 3422f02abc1SKonstantin Belousov.Xr pthread_create 3 , 3432f02abc1SKonstantin Belousov.Xr signal 3 , 3442f02abc1SKonstantin Belousov.Xr atomic 9 3456a701619SBenedict Reuschling.Sh HISTORY 3466a701619SBenedict ReuschlingThe 3476a701619SBenedict Reuschling.Nm 3486a701619SBenedict Reuschlinglibrary first appeared in 3496a701619SBenedict Reuschling.Fx 5.2 . 3505335c6bcSRobert Watson.Sh AUTHORS 3515335c6bcSRobert Watson.An -nosplit 35248856b00SRuslan ErmilovThe 3535335c6bcSRobert Watson.Nm 35448856b00SRuslan Ermilovlibrary 3555335c6bcSRobert Watsonwas originally created by 3562b7af31cSBaptiste Daroussin.An Jeff Roberson Aq Mt jeff@FreeBSD.org , 3575335c6bcSRobert Watsonand enhanced by 3582b7af31cSBaptiste Daroussin.An Jonathan Mini Aq Mt mini@FreeBSD.org 3595335c6bcSRobert Watsonand 3602b7af31cSBaptiste Daroussin.An Mike Makonnen Aq Mt mtm@FreeBSD.org . 3615335c6bcSRobert WatsonIt has been substantially rewritten and optimized by 3622b7af31cSBaptiste Daroussin.An David Xu Aq Mt davidxu@FreeBSD.org . 363