NetBSD/lib/libpthread/threads.3

99 lines
4.0 KiB
Groff
Raw Normal View History

2019-04-27 13:57:11 +03:00
.\" $NetBSD: threads.3,v 1.2 2019/04/27 10:57:11 wiz Exp $
.\"
.\" Copyright (c) 2016 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Kamil Rytarowski.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd October 16, 2016
2019-04-27 13:57:11 +03:00
.Dt THREADS 3
.Os
.Sh NAME
.Nm threads
.Nd C11 thread support library
.Sh LIBRARY
.Lb libpthread
.Sh SYNOPSIS
.In threads.h
.Sh DESCRIPTION
2019-04-27 13:57:11 +03:00
The C11 thread support library provides an implementation of a portable threading
interface, built on top of the
.Xr pthread 3
native interfaces.
This library is composed of:
.Bl -dash
.It
Initialization functions.
.It
Condition variable functions.
.It
Mutex functions.
.It
Thread functions.
.It
Thread-specifig storage functions.
.El
.Bl -column "mtx_timedwait"
.It Sy "Function" Ta Sy "Summary"
.It Xr call_once 3 Ta calls function exactly once
.It Xr cnd_broadcast 3 Ta unblocks all threads blocked on a condition
.It Xr cnd_destroy 3 Ta releases all resources used by a condition
.It Xr cnd_init 3 Ta creates a condition variable
.It Xr cnd_signal 3 Ta unblocks one of threads blocked on a condition
.It Xr cnd_timedwait 3 Ta unlocks a mutex and blocks until a signal or timeout
.It Xr cnd_wait 3 Ta unlocks a mutex and blocks until a signal
.It Xr mtx_destroy 3 Ta releases resources used by a mutex
.It Xr mtx_init 3 Ta creates a mutex object with requested properties
.It Xr mtx_lock 3 Ta blocks on a mutex optionally with a recursive type
.It Xr mtx_timedwait 3 Ta tries to block until it locks a mutex or timeout
.It Xr mtx_trylock 3 Ta tries to lock a mutex
.It Xr mtx_unlock 3 Ta unlocks a mutex
.It Xr thrd_create 3 Ta creates a thread executing a function with a parameter
.It Xr thrd_current 3 Ta identifies the thread that called this function
2019-04-27 13:57:11 +03:00
.It Xr thrd_detach 3 Ta dispose of resources allocated to a thread on exit
.It Xr thrd_equal 3 Ta determines whether two threads refer the same thread
.It Xr thrd_exit 3 Ta terminates a calling thread and sets its result code
.It Xr thrd_join 3 Ta joins a thread with the current one and blocks
.It Xr thrd_sleep 3 Ta suspends a calling thread until a signal or timeout
2019-04-27 13:57:11 +03:00
.It Xr tss_create 3 Ta creates a thread-specific storage pointer with a destructor
.It Xr tss_delete 3 Ta releases resources used by a thread-specific storage
.It Xr tss_get 3 Ta gets a value of thread-specific storage from a key
.It Xr tss_set 3 Ta sets a value of thread-specific storage to a key
.El
.Sh SEE ALSO
.Xr c11 1 ,
.Xr pthread 3 ,
.Xr c 7
.Sh STANDARDS
The
.Nm
library interfaces conform to
.St -isoC-2011 .
.Sh HISTORY
This interface first appeared in
.Nx 9 .
.Sh AUTHORS
.An Kamil Rytarowski Aq Mt kamil@NetBSD.org