Next: The ISO C multithreading API, Previous: Choosing the right multithreading API, Up: Multithreading [Contents][Index]
The POSIX multithreading API is documented in POSIX https://pubs.opengroup.org/onlinepubs/9699919799/.
To make use of POSIX multithreading, even on platforms that don’t support it natively (most prominently, native Windows), use the following Gnulib modules:
Purpose | Module |
---|---|
For thread creation and management: | pthread-thread |
For simple and recursive locks: | pthread-mutex |
For read-write locks: | pthread-rwlock |
For once-only execution: | pthread-once |
For “condition variables” (wait queues): | pthread-cond |
For thread-local storage: | pthread-tss |
For relinquishing control: | sched_yield |
For spin locks: | pthread-spin |
There is also a convenience module named pthread
which depends on all
of these (except sched_yield
); so you don’t need to enumerate these
modules one by one.