NAME intro - Introduction to DCE Threads DESCRIPTION DCE Threads are a set of routines that you can call to create a multi- threaded program. Multithreading is used to improve the performance of a program. Routines implemented by DCE Threads that are not speci- fied by Draft 4 of the POSIX 1003.4a standard are indicated by an _np suffix on the name. These routines are not portable. The pthread interface routines are grouped in the following functional categories: + General threads routines + Thread attributes object routines + Thread cancelation routines + Thread priority, concurrency, and scheduling routines + Thread-specific data routines + Mutex routines + Mutex attributes object routines + Condition variable routines + Condition variable attribute object routines DECthreads also provides routines that implement nonportable extensions to the POSIX 1003.1c standard. These routines are grouped into these functional categories: + Thread execution routines + Thread attributes routines + DECthreads global mutex routines + Mutex attributes routines + Condition variable routines + DECthreads exception object routines
1 – General Threads Routines
pthread_create Creates a thread object and thread. pthread_detach Marks a thread object for deletion. pthread_equal Compares one thread identifier to another thread identifier. pthread_exit Terminates the calling thread. pthread_join Causes the calling thread to wait for the termination of a specified thread and detach it. pthread_once Calls an initialization routine to be executed only once. pthread_self Obtains the identifier of the current thread.
2 – Thread Attributes Object Routines
pthread_attr_destroy Destroys a thread attributes object. pthread_attr_getdetachstate Obtains the detachstate attribute from the specified thread attributes object. pthread_attr_getguardsize Obtains the guardsize attribute of the specified thread attributes object. pthread_attr_getinheritsched Obtains the inherit scheduling attribute from the specified thread attributes object. pthread_attr_getschedparam Obtains the scheduling parameters for an attribute of the specified thread attributes object. pthread_attr_getschedpolicy Obtains the scheduling policy attribute of the specified thread attributes object. pthread_attr_getscope Obtains the contention-scope attribute of the specified thread attributes object. pthread_attr_getstackaddr Obtains the stackaddr attribute of the specified thread attributes object. pthread_attr_getstacksize Obtains the stacksize attribute of the specified thread attributes object. pthread_attr_init Initializes a thread attributes object. pthread_attr_setdetachstate Changes the detachstate attribute in the specified thread attributes object. pthread_attr_setguardsize Changes the guardsize attribute of the specified thread attributes object. pthread_attr_setinheritsched Changes the inherit scheduling attribute of the specified thread attributes object. pthread_attr_setschedparam Changes the values of the parameters associated with the scheduling policy attribute of the specified thread attri- butes object. pthread_attr_setschedpolicy Changes the scheduling policy attribute of the specified thread attributes object. pthread_attr_setstackaddr Changes the stackaddr attribute in the specified thread attributes object. pthread_attr_setstacksize Changes the stacksize attribute in the specified thread attributes object.
3 – Thread Cancellation Routines
pthread_cancel Allows a thread to request that it, or another thread, terminate execution. pthread_cleanup_pop Removes a cleanup handler routine from the top of the cleanup stack and optionally executes it. pthread_cleanup_push Establishes a cleanup handler routine to be executed when the thread exits or is canceled. pthread_setcancelstate Sets the current thread's cancelability state. pthread_setcanceltype Sets the current thread's cancelability type. pthread_testcancel Requests delivery of any pending cancelation request to the current thread.
4 – Thread Priority Concurrency and Scheduling Routines
pthread_getconcurrency Obtains the current concurrency level parameter for the process. pthread_getschedparam Obtains the current scheduling policy and scheduling parameters of a thread. pthread_getsequence_np Obtains a thread sequence number. pthread_setconcurrency Changes the current concurrency level parameter for the process. pthread_setschedparam Changes the current scheduling policy and scheduling parameters of a thread.
5 – Thread Specific Data Routines
pthread_getspecific Obtains the thread-specific data associated with the specified key. pthread_key_create Generates a unique thread-specific data key. pthread_setspecific Sets the thread-specific data value associated with the specified key for the current thread. pthread_key_delete Deletes a thread-specific data key.
6 – Mutex Routines
pthread_mutex_destroy Destroys a mutex. pthread_mutex_init Initializes a mutex with attributes specified by the attributes argument. pthread_mutex_lock Locks an unlocked mutex; if locked, the caller waits for the mutex to become available. pthread_mutex_trylock Attempts to lock a mutex; returns immediately if mutex is already locked. pthread_mutex_unlock Unlocks a locked mutex.
7 – Mutex Attributes Object Routines
pthread_mutexattr_init Initializes a mutex attributes object. pthread_mutexattr_destroy Destroys a mutex attributes object. pthread_mutexattr_gettype Obtains the mutex type attribute of a mutex attributes object. pthread_mutexattr_settype Changes the mutex type attribute of a mutex attributes object.
8 – Condition Variable Routines
pthread_cond_broadcast Wakes all threads waiting on a condition variable. pthread_cond_destroy Destroys a condition variable. pthread_cond_init Initializes a condition variable. pthread_cond_signal Wakes at least one thread that is waiting on a condition variable. pthread_cond_timedwait Causes a thread to wait for a specified period of time for a condition variable to be signaled or broadcasted. pthread_cond_wait Causes a thread to wait for a condition variable to be signaled or broadcasted.
9 – Condition Variable Attributes Object Routines
pthread_condattr_destroy Destroys a condition variable attributes object. pthread_condattr_init Initializes a condition variable attributes object.
10 – Non Portable Extensions
DECthreads also provides routines that implement nonportable extensions to the POSIX 1003.1c standard. These routines are grouped into these functional categories:
10.1 – Thread Execution Routines
pthread_delay_np Causes a thread to delay execution. pthread_get_expiration_np Obtains a value representing a desired expiration time. pthread_getsequence_np Obtains the thread sequence number.
10.2 – Thread Attributes Routines
pthread_attr_getguardsize_np Obtains the guardsize attribute of the specified thread attributes object. pthread_attr_setguardsize_np Changes the guardsize attribute of the specified thread attributes object.
10.3 – DECthreads Global Mutex Routines
pthread_lock_global_np Locks the DECthreads global mutex if it is unlocked. pthread_unlock_global_np Unlocks the DECthreads lobal mutex if it is locked.
10.4 – Mutex Attributes Routines
pthread_mutexattr_gettype_np Obtains the mutex type attribute of a mutex attributes object. pthread_mutexattr_settype_np Changes the mutex type attribute of a mutex attributes object.
10.5 – Condition Variable Routines
pthread_cond_signal_int_np Wakes one thread that is waiting on a condition variable (called from interrupt level only).
10.6 – DECthreads Exception Object Routines
pthread_exc_get_status_np Obtains a system-defined error status from a DECthreads status exception object. pthread_exc_matches_np Determines whether two DECthreads exception objects are identical. pthread_exc_report_np Produces a message that reports what a specified DECthreads status exception object represents. pthread_exc_set_status_np Imports a system-defined error status into a DECthreads address exception object.