- NetBSD Manual Pages
PTHREAD(3) NetBSD Library Functions Manual PTHREAD(3)
Powered by man-cgi (2021-03-02).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.
pthread -- POSIX Threads Library
POSIX Threads Library (libpthread, -lpthread)
cc [flags] files -lpthread [libraries]
The pthread library provides an implementation of the standard POSIX
The NetBSD implementation is based on 1:1 thread model, therefore each
pthread has a kernel thread, called a light-weight process (LWP).
Note that the system private thread interfaces upon which the pthread
library is built are subject to change without notice. In order to
remain compatible with future NetBSD releases, programs must be linked
against the dynamic version of the thread library. Statically linked
programs using the POSIX threads framework may not work when run on a
future version of the system.
The following functions comprise the core of the pthread library:
pthread_attr(3) thread attribute operations
pthread_barrier_destroy(3) destroy a barrier
pthread_barrier_init(3) create a barrier
pthread_barrier_wait(3) wait for a barrier
pthread_barrierattr(3) barrier attribute operations
pthread_cancel(3) cancel the execution of a thread
pthread_cleanup_push(3) add or remove cleanup functions
pthread_cond_broadcast(3) unblock one or more threads
pthread_cond_destroy(3) destroy a condition variable
pthread_cond_init(3) create a condition variable
pthread_cond_wait(3) wait for a condition variable
pthread_condattr(3) condition attribute operations
pthread_create(3) create a new thread
pthread_detach(3) detach a thread
pthread_equal(3) compare thread identifiers
pthread_exit(3) terminate the calling thread
pthread_getspecific(3) get a thread-specific data value
pthread_join(3) wait for thread termination
pthread_key_create(3) thread-specific data key creation
pthread_key_delete(3) delete a thread-specific data key
pthread_kill(3) send a signal to a specific thread
pthread_mutex_destroy(3) free a mutex
pthread_mutex_init(3) create a mutex
pthread_mutex_lock(3) acquire a lock on a mutex
pthread_mutex_unlock(3) unlock a mutex
pthread_mutexattr(3) mutex attribute operations
pthread_once(3) dynamic package initialization
pthread_rwlock_destroy(3) destroy a read/write lock
pthread_rwlock_init(3) initialize a read/write lock
pthread_rwlock_rdlock(3) acquire a read/write lock for reading
pthread_rwlock_unlock(3) release a read/write lock
pthread_rwlock_wrlock(3) acquire a read/write lock for writing
pthread_rwlockattr(3) read/write lock attribute operations
pthread_schedparam(3) thread scheduling manipulation
pthread_self(3) get the ID of the calling thread
pthread_setspecific(3) get a thread-specific data value
pthread_sigmask(3) manipulate a thread's signal mask
pthread_spin_destroy(3) destroy a spin lock
pthread_spin_init(3) initialize a spin lock
pthread_spin_lock(3) acquire a spin lock
pthread_spin_unlock(3) release a spin lock
pthread_testcancel(3) set cancelability state
The following environment variables affect the behavior of the library:
Possible values are any combinations of:
A Report errors to application by error return, but do not abort.
a Abort on errors, creating a core dump for further debugging.
E Do not log errors to stdout.
e Log errors to stdout.
L Do not log errors via syslogd(8).
l Log errors via syslogd(8).
If not set in the environment, the pthread library behaves as if AEL
has been specified.
Integer value giving the stack size in kilobytes. This allows to
set a smaller stack size than the default stack size. The default
stack size is the current limit on the stack size as set with the
shell's command to change limits (limit for csh(1), or ulimit for
David R. Butenhof, Programming with POSIX(R) Threads, Addison-Wesley,
The pthread library conforms to IEEE Std 1003.1-2001 (``POSIX.1'').
Due to limitations in the current pthread implementation, makecontext(3)
and sigaltstack(2) should not be used in programs which link against the
pthread library (whether threads are used or not).
NetBSD 9.99 November 22, 2016 NetBSD 9.99