HP-UX Reference (11i v1 00/12) - 3 Library Functions N-Z (vol 7)

__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/nan.3m
________________________________________________________________
___ ___
p
pthread(3T) pthread(3T)
(Pthread Library)
These functions are used to manipulate the scheduling policy and priority for a thread.
sched_get_priority_max(),
sched_get_priority_min()
These functions are used to interrogate the priority range for a given scheduling policy.
sched_yield This function is used by a thread to yield the processor to other threads of equal or
greater priority.
COMMUNICATION & SYNCHRONIZATION
Multi-threaded applications concurrently execute instructions. Access to process-wide (or interprocess)
shared resources (memory, file descriptors, etc.) requires mechanisms for coordination or synchronization
among threads. The libpthread library offers synchronization primitives necessary to create a deterministic
application. A multi-threaded application ensures determinism by forcing asynchronous thread contexts to
synchronize, or serialize, access to data structures and resources managed and manipulated during run-
time. These are mutual-exclusion (mutex) locks, condition variables, and read-write locks. The HP-UX
operating system also provides POSIX semaphores (see next section).
Mutexes furnish the means to exclusively guard data structures from concurrent modification. Their proto-
col precludes more than one thread which has locked the mutex from changing the contents of the pro-
tected structure until the locker performs an analogous mutex unlock. A mutex can be initialized in two
ways: by a call to pthread_mutex_init()
; or by assignment of PTHREAD_MUTEX_INITIALIZER.
Condition Variables are used by a thread to wait for the occurrence of some event. A thread detecting or
causing such an event can signal or broadcast that occurrence to the waiting thread or threads.
Read-Write locks permit concurrent read access by multiple threads to structures guarded by a read-write
lock, but write access by only a single thread.
pthread_mutex_init()
,
pthread_mutex_destroy()
Initialize/destroy contents of a mutex lock.
pthread_mutex_lock()
,
pthread_mutex_trylock()
,
pthread_mutex_unlock()
Lock/unlock a mutex.
pthread_mutex_getprioceiling()
,
pthread_mutex_setprioceiling()
Manipulatemutex locking priorities.
pthread_mutexattr_init()
,
pthread_mutexattr_destroy(),
pthread_mutexattr_getprioceiling(),
pthread_mutexattr_getprotocol(),
pthread_mutexattr_getpshared(),
pthread_mutexattr_gettype(),
pthread_mutexattr_getspin_np()
,
pthread_mutexattr_setprioceiling()
,
pthread_mutexattr_setprotocol()
,
pthread_mutexattr_setpshared()
,
pthread_mutexattr_settype()
,
pthread_mutexattr_setspin_np()
Manage mutex attributes used for pthread_mutex_init(). Only the "prioceiling" attribute can
be changed for an exiting mutex.
pthread_mutex_getyieldfreq_np(),
pthread_mutex_setyieldfreq_np()
These functions, together with the spin attributes, are used to tune mutex performance to the specific
application.
pthread_cond_init()
,
pthread_cond_destroy()
HP-UX Release 11i: December 2000 5 Section 3635
___
___