Table 11-29. libpthread Definition
Library: | libpthread |
SONAME: | libpthread.so.0 |
LSB systems support POSIX threads with the following exceptions. This list is intended to match the behavior of historical Linux implementations. Applications should be written to deal with either POSIX threads or the thread behaviors described here.
POSIX specifies a concept of per-process rather than per-thread signals. The LSB does not require this behavior; traditional Linux implementations have had per-thread signals only. A related issue is that applications cannot rely on getpid() returning the same value in different threads.
Note: one implication of per-thread signals is that a core dump (for example) may not stop all threads in a given process. This may be an issue when designing ways to stop/start applications.
Applications which create child processes (using fork() and the like) must then wait for them (using waitpid() family of functions) in the same thread as they created them. Note that coding applications this way will work both with full POSIX threads and legacy Linux thread implementations.
POSIX specifies that changing the user or group id instantly affects the behavior of all threads. This behavior is not specified; applications must use their own lock if they need this behavior. Rationale: it seems unnecessary and it is a performance hit (an SMP kernel must lock the user id).
Although this standard doesn't have a way to list processes (/proc or "ps" command line isn't in, right?), it is our intention to not specify one way or the other whether multiple threads appear as separate processes or as a single process.
Applications cannot rely on resource limits (getrusage and setrusage) being maintained per-process rather than per-thread.
Applications must disconnect from the controlling tty before calling pthread_create.
times() doesn't account for all threads, just the caller.
Applications must not call pthread_cancel if they call any system libraries (most notably X Window System libraries), as system libraries are not guaranteed to be thread safe. Likewise, for such libraries, only one thread per process may call them.
Applications cannot rely on fcntl/lockf locks being visible per-process rather than per-thread. Likewise for mandatory file locks.
Threaded applications cannot use SIGUSR1 or SIGUSR2.
The behavior of the interfaces in this library is specified by the following standards.
Linux Standard Base[1] |
CAE Specification, January 1997, System Interfaces and Headers (XSH), Issue 5 (ISBN: 1-85912-181-0, C606)[2] |
Table 11-30. libpthread - Posix Threads Function Interfaces
pthread_attr_destroy[2] | pthread_attr_setstackaddr[2] | pthread_getspecific[2] | pthread_once[2] | pthread_setcanceltype[2] |
pthread_attr_getdetachstate[2] | pthread_attr_setstacksize[2] | pthread_join[2] | pthread_rwlock_destroy[2] | pthread_setconcurrency[2] |
pthread_attr_getguardsize[2] | pthread_cancel[2] | pthread_key_create[2] | pthread_rwlock_init[2] | pthread_setschedparam[2] |
pthread_attr_getinheritsched[2] | pthread_cond_broadcast[2] | pthread_key_delete[2] | pthread_rwlock_rdlock[2] | pthread_setspecific[2] |
pthread_attr_getschedparam[2] | pthread_cond_destroy[2] | pthread_kill[2] | pthread_rwlock_timedrdlock[2] | pthread_sigmask[2] |
pthread_attr_getschedpolicy[2] | pthread_cond_init[2] | pthread_mutex_destroy[2] | pthread_rwlock_timedwrlock[2] | pthread_testcancel[2] |
pthread_attr_getscope[2] | pthread_cond_signal[2] | pthread_mutex_init[2] | pthread_rwlock_tryrdlock[2] | sem_close[2] |
pthread_attr_getstackaddr[2] | pthread_cond_timedwait[2] | pthread_mutex_lock[2] | pthread_rwlock_trywrlock[2] | sem_destroy[2] |
pthread_attr_getstacksize[2] | pthread_cond_wait[2] | pthread_mutex_trylock[2] | pthread_rwlock_unlock[2] | sem_getvalue[2] |
pthread_attr_init[2] | pthread_condattr_destroy[2] | pthread_mutex_unlock[2] | pthread_rwlock_wrlock[2] | sem_init[2] |
pthread_attr_setdetachstate[2] | pthread_condattr_init[2] | pthread_mutexattr_destroy[2] | pthread_rwlockattr_destroy[2] | sem_open[2] |
pthread_attr_setguardsize[2] | pthread_create[2] | pthread_mutexattr_getpshared[2] | pthread_rwlockattr_getpshared[2] | sem_post[2] |
pthread_attr_setinheritsched[2] | pthread_detach[2] | pthread_mutexattr_gettype[2] | pthread_rwlockattr_init[2] | sem_timedwait[1] |
pthread_attr_setschedparam[2] | pthread_equal[2] | pthread_mutexattr_init[2] | pthread_rwlockattr_setpshared[2] | sem_trywait[2] |
pthread_attr_setschedpolicy[2] | pthread_exit[2] | pthread_mutexattr_setpshared[2] | pthread_self[2] | sem_unlink[2] |
pthread_attr_setscope[2] | pthread_getschedparam[2] | pthread_mutexattr_settype[2] | pthread_setcancelstate[2] | sem_wait[2] |
[1] | Linux Standard Base |
[2] | CAE Specification, January 1997, System Interfaces and Headers (XSH), Issue 5 (ISBN: 1-85912-181-0, C606) |