-------------------------------------------------- Introduction to POSIX Threads (pthreads) -------------------------------------------------- The pthread interface routines are grouped in the following functional categories: o General Threads Routines o Attributes Object Routines o Condition Variable Routines o Mutex Routines o Thread-Specific Data Routines o Thread Cancelation Routines o Thread Priority and Scheduling Routines *** General Threads Routines pthread_atfork Declares fork handlers to be called. 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_kill Delivers a signal to a specified thread. pthread_once Calls an initialization routine to be executed only once. pthread_self Obtains the identifier of the current thread. pthread_sigmask Examines or changes the current thread's signal mask. *** 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_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_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_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 attributes object. pthread_attr_setschedpolicy Changes the scheduling policy attribute of the specified thread attributes object. pthread_attr_setstacksize Changes the stacksize attribute in the specified thread attributes object. *** Condition Variable Attributes Object Routines pthread_condattr_init Initializes a condition variable attributes object that spec- ifies condition variable attributes when created. pthread_condattr_destroy Destroys a condition variable attributes object. *** Mutex Attributes Object Routines pthread_mutexattr_init Initializes a mutex attributes object. pthread_mutexattr_destroy Destroys a mutex attributes object. *** 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 Locks an unlocked mutex or returns immediately if mutex is locked. pthread_mutex_unlock Unlocks a mutex. *** 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 condition variable to be sig- naled or broadcasted for a specified period of time. pthread_cond_wait Causes a thread to wait for a condition variable to be sig- naled or broadcasted. *** Thread-Specific Data Routines pthread_getspecific Obtains the thread-specific data associated with the speci- fied key. pthread_key_create Generates a unique thread-specific data key. pthread_setspecific Sets the thread-specific data value associated with the spec- ified key for the current thread. pthread_key_delete Deletes a thread-specific data key. *** Thread Cancellation Routines pthread_cancel Allows a thread to request that it, or another thread termi- nate execution. pthread_cleanup_pop Removes a cleanup handler at the top of the cleanup stack and optionally executes it. pthread_cleanup_push Establishes a cleanup handler 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 cancel to the current thread. *** Thread Priority and Scheduling Routines pthread_getschedparam Obtains the current scheduling policy and sceduling parame- ters of a thread. pthread_getsequence_np Obtains a thread sequence number. pthread_setschedparam Changes the current scheduling policy and scheduling parame- ters of a thread. sched_yield Notifies the scheduler that the current thread will release its processor to other threads of the same or higher prior- ity.