THREADS(3)

THREADS(3) | Library Functions Manual | THREADS(3)

# NAME

`threads` —
C11 thread support library

# LIBRARY

POSIX Threads Library (libpthread, -lpthread)

# SYNOPSIS

`#include <threads.h>`

# DESCRIPTION

The C11 thread support library provides an implementation of a portable threading interface, built on top of the pthread(3) native interfaces. This library is composed of:

- Initialization functions.
- Condition variable functions.
- Mutex functions.
- Thread functions.
- Thread-specifig storage functions.

Function | Summary
call_once(3) | calls function exactly once
cnd_broadcast(3) | unblocks all threads blocked on a condition
cnd_destroy(3) | releases all resources used by a condition
cnd_init(3) | creates a condition variable
cnd_signal(3) | unblocks one of threads blocked on a condition
cnd_timedwait(3) | unlocks a mutex and blocks until a signal or timeout
cnd_wait(3) | unlocks a mutex and blocks until a signal
mtx_destroy(3) | releases resources used by a mutex
mtx_init(3) | creates a mutex object with requested properties
mtx_lock(3) | blocks on a mutex optionally with a recursive type
mtx_timedwait(3) | tries to block until it locks a mutex or timeout
mtx_trylock(3) | tries to lock a mutex
mtx_unlock(3) | unlocks a mutex
thrd_create(3) | creates a thread executing a function with a parameter
thrd_current(3) | identifies the thread that called this function
thrd_detach(3) | dispose of resources allocated to a thread on exit
thrd_equal(3) | determines whether two threads refer the same thread
thrd_exit(3) | terminates a calling thread and sets its result code
thrd_join(3) | joins a thread with the current one and blocks
thrd_sleep(3) | suspends a calling thread until a signal or timeout
tss_create(3) | creates a thread-specific storage pointer with a destructor
tss_delete(3) | releases resources used by a thread-specific storage
tss_get(3) | gets a value of thread-specific storage from a key
tss_set(3) | sets a value of thread-specific storage to a key

# SEE ALSO

c11(1), pthread(3), c(7)

# STANDARDS

The `threads` library interfaces conform to ISO/IEC 9899:2011 (“ISO C11”).

# HISTORY

This interface first appeared in NetBSD 9.

# AUTHORS

Kamil Rytarowski <kamil@NetBSD.org>

October 16, 2016 | NetBSD 9.3