1.\" $NetBSD: threads.3,v 1.2 2019/04/27 10:57:11 wiz Exp $ 2.\" 3.\" Copyright (c) 2016 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Kamil Rytarowski. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28.\" POSSIBILITY OF SUCH DAMAGE. 29.\" 30.Dd October 16, 2016 31.Dt THREADS 3 32.Os 33.Sh NAME 34.Nm threads 35.Nd C11 thread support library 36.Sh LIBRARY 37.Lb libpthread 38.Sh SYNOPSIS 39.In threads.h 40.Sh DESCRIPTION 41The C11 thread support library provides an implementation of a portable threading 42interface, built on top of the 43.Xr pthread 3 44native interfaces. 45This library is composed of: 46.Bl -dash 47.It 48Initialization functions. 49.It 50Condition variable functions. 51.It 52Mutex functions. 53.It 54Thread functions. 55.It 56Thread-specifig storage functions. 57.El 58.Bl -column "mtx_timedwait" 59.It Sy "Function" Ta Sy "Summary" 60.It Xr call_once 3 Ta calls function exactly once 61.It Xr cnd_broadcast 3 Ta unblocks all threads blocked on a condition 62.It Xr cnd_destroy 3 Ta releases all resources used by a condition 63.It Xr cnd_init 3 Ta creates a condition variable 64.It Xr cnd_signal 3 Ta unblocks one of threads blocked on a condition 65.It Xr cnd_timedwait 3 Ta unlocks a mutex and blocks until a signal or timeout 66.It Xr cnd_wait 3 Ta unlocks a mutex and blocks until a signal 67.It Xr mtx_destroy 3 Ta releases resources used by a mutex 68.It Xr mtx_init 3 Ta creates a mutex object with requested properties 69.It Xr mtx_lock 3 Ta blocks on a mutex optionally with a recursive type 70.It Xr mtx_timedwait 3 Ta tries to block until it locks a mutex or timeout 71.It Xr mtx_trylock 3 Ta tries to lock a mutex 72.It Xr mtx_unlock 3 Ta unlocks a mutex 73.It Xr thrd_create 3 Ta creates a thread executing a function with a parameter 74.It Xr thrd_current 3 Ta identifies the thread that called this function 75.It Xr thrd_detach 3 Ta dispose of resources allocated to a thread on exit 76.It Xr thrd_equal 3 Ta determines whether two threads refer the same thread 77.It Xr thrd_exit 3 Ta terminates a calling thread and sets its result code 78.It Xr thrd_join 3 Ta joins a thread with the current one and blocks 79.It Xr thrd_sleep 3 Ta suspends a calling thread until a signal or timeout 80.It Xr tss_create 3 Ta creates a thread-specific storage pointer with a destructor 81.It Xr tss_delete 3 Ta releases resources used by a thread-specific storage 82.It Xr tss_get 3 Ta gets a value of thread-specific storage from a key 83.It Xr tss_set 3 Ta sets a value of thread-specific storage to a key 84.El 85.Sh SEE ALSO 86.Xr c11 1 , 87.Xr pthread 3 , 88.Xr c 7 89.Sh STANDARDS 90The 91.Nm 92library interfaces conform to 93.St -isoC-2011 . 94.Sh HISTORY 95This interface first appeared in 96.Nx 9 . 97.Sh AUTHORS 98.An Kamil Rytarowski Aq Mt kamil@NetBSD.org 99