NAME
pptthhrreeaaddmmuutteexxaattttrriinniitt, pptthhrreeaaddmmuutteexxaattttrrddeessttrrooyy, pptthhrreeaaddmmuutteexxaattttrrsseettpprriioocceeiilliinngg, pptthhrreeaaddmmuutteexxaattttrrggeettpprriioocceeiilliinngg, pptthhrreeaaddmmuutteexxaattttrrsseettpprroottooccooll, pptthhrreeaaddmmuutteexxaattttrrggeettpprroottooccooll,pptthhrreeaaddmmuutteexxaattttrrsseettttyyppee, pptthhrreeaaddmmuutteexxaattttrrggeettttyyppee - mutex attribute
operationsSYNOPSIS
##iinncclluuddee <
int pptthhrreeaaddmmuutteexxaattttrriinniitt(pthreadmutexattrt *attr); int pptthhrreeaaddmmuutteexxaattttrrddeessttrrooyy(pthreadmutexattrt *attr); int pptthhrreeaaddmmuutteexxaattttrrsseettpprriioocceeiilliinngg(pthreadmutexattrt *attr, int prioceiling); int pptthhrreeaaddmmuutteexxaattttrrggeettpprriioocceeiilliinngg(pthreadmutexattrt *attr, int *prioceiling); int pptthhrreeaaddmmuutteexxaattttrrsseettpprroottooccooll(pthreadmutexattrt *attr, int protocol); int pptthhrreeaaddmmuutteexxaattttrrggeettpprroottooccooll(pthreadmutexattrt *attr, int *protocol); int pptthhrreeaaddmmuutteexxaattttrrsseettttyyppee(pthreadmutexattrt *attr, int type); int pptthhrreeaaddmmuutteexxaattttrrggeettttyyppee(pthreadmutexattrt *attr, int *type);> DESCRIPTION
Mutex attributes are used to specify parameters to pptthhrreeaaddmmuutteexxiinniitt(). One attribute object can be used in multiple calls to pptthhrreeaaddmmuutteexxiinniitt(), with or without modifications between calls. The pptthhrreeaaddmmuutteexxaattttrriinniitt() function initializes attr with all the default mutex attributes. The pptthhrreeaaddmmuutteexxaattttrrddeessttrrooyy() function destroys attr. The pptthhrreeaaddmmuutteexxaattttrrsseettttyyppee() functions set the mutex type value of the attribute. Valid mutex types are: PTHREADMUTEXNORMAL,PTHREADMUTEXERRORCHECK, PTHREADMUTEXRECURSIVE, and
PTHREADMUTEXDEFAULT. The default mutex type for pptthhrreeaaddmmuutteexxaaddddrriinniitt() is PTHREADMUTEXDEFAULT. PTHREADMUXEXNORMAL mutexes do not check for usage errors. PTHREADMUTEXNORMAL mutexes will deadlock if reentered, and result in undefined behavior if a locked mutex is unlocked by another thread. Attempts to unlock an already unlocked PTHREADMUTEXNORMAL mutex will result in undefined behavior.PTHREADMUTEXERRORCHECK mutexes do check for usage errors. If an
attempt is made to relock a PTHREADMUTEXERRORCHECK mutex without first
dropping the lock an error will be returned. If a thread attempts tounlock a PTHREADMUTEXERRORCHECK mutex that is locked by another thread,
an error will be returned. If a thread attemps to unlock aPTHREADMUTEXERRORCHECK thread that is unlocked, an error will be
returned. PTHREADMUTEXRECURSIVE mutexes allow recursive locking. An attempt to relock a PTHREADMUTEXRECURSIVE mutex that is already locked by the same thread succeeds. An equivalent number of pthreadmutexunlock(3) calls are needed before the mutex will wake another thread waiting on this lock. If a thread attempts to unlock a PTHREADMUTEXRECURSIVE mutex that is locked by another thread, an error will be returned. If a thread attemps to unlock a PTHREADMUTEXRECURSIVE thread that is unlocked, an error will be returned. PTHREADMUTEXDEFAULT mutexes result in undefined behavior if reentered. Unlocking a PTHREADMUTEXDEFAULT mutex locked by another thread will result in undefined behavior. Attempts to unlock an already unlocked PTHREADMUTEXDEFAULT mutex will result in undefined behavior. pptthhrreeaaddmmuutteexxaattttrrggeettttyyppee() functions copy the type value of the attribute to the location pointed to by the second parameter. The pptthhrreeaaddmmuutteexxaattttrrsseett**() functions set the attribute that corresponds to each function name. The pptthhrreeaaddmmuutteexxaattttrrggeett**() functions copy the value of the attribute that corresponds to each function name to the location pointed to by the second function parameter.RETURN VALUES
If successful, these functions return 0. Otherwise, an error number is returned to indicate the error. EERRRROORRSS pptthhrreeaaddmmuutteexxaattttrriinniitt() will fail if: [ENOMEM] Out of memory. pptthhrreeaaddmmuutteexxaattttrrddeessttrrooyy() will fail if: [EINVAL] Invalid value for attr. pptthhrreeaaddmmuutteexxaattttrrsseettpprriioocceeiilliinngg() will fail if: [EINVAL] Invalid value for attr, or invalid value for prioceiling. pptthhrreeaaddmmuutteexxaattttrrggeettpprriioocceeiilliinngg() will fail if: [EINVAL] Invalid value for attr. pptthhrreeaaddmmuutteexxaattttrrsseettpprroottooccooll() will fail if: [EINVAL] Invalid value for attr, or invalid value for protocol. pptthhrreeaaddmmuutteexxaattttrrggeettpprroottooccooll() will fail if: [EINVAL] Invalid value for attr. pptthhrreeaaddmmuutteexxaattttrrsseettttyyppee() will fail if: [EINVAL] Invalid value for attr, or invalid value for type. pptthhrreeaaddmmuutteexxaattttrrggeettttyyppee() will fail if: [EINVAL] Invalid value for attr.SEE ALSO
pthreadmutexinit(3) STANDARDS pptthhrreeaaddmmuutteexxaattttrriinniitt() and pptthhrreeaaddmmuutteexxaattttrrddeessttrrooyy() conform toISO/IEC 9945-1:1996 (``POSIX.1'')
pptthhrreeaaddmmuutteexxaattttrrsseettpprriioocceeiilliinngg(), pptthhrreeaaddmmuutteexxaattttrrggeettpprriioocceeiilliinngg(), pptthhrreeaaddmmuutteexxaattttrrsseettpprroottooccooll(), pptthhrreeaaddmmuutteexxaattttrrggeettpprroottooccooll(), pptthhrreeaaddmmuutteexxaattttrrsseettttyyppee(), and pptthhrreeaaddmmuutteexxaattttrrggeettttyyppee() conform to Version 2 of the Single UNIX Specification (``SUSv2'') BSD January 30, 2003 BSD