NAME
pthread —
POSIX Threads Library
LIBRARY
POSIX Threads Library (libpthread, -lpthread)
SYNOPSIS
#include <pthread.h>
cc |
[flags]
files -lpthread
[libraries] |
DESCRIPTION
The
pthread library provides an implementation of the standard
POSIX threads library.
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.
FUNCTIONS
The following functions comprise the core of the
pthread
library:
ENVIRONMENT
The following environment variables affect the behavior of the library:
-
-
PTHREAD_DIAGASSERT
- 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.
-
-
PTHREAD_STACKSIZE
- 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
sh(1)).
SEE ALSO
David R. Butenhof,
Programming with POSIX(R) Threads,
Addison-Wesley, 1997.
STANDARDS
The
pthread library conforms to
IEEE Std
1003.1-2001 (“POSIX.1”).
CAVEATS
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).