MyWebUniversity.com Home Page
 



Darwin Mac OS X man pages main menu
PTHREADMUTEXATR(3)     BSD Library Functions Manual     PTHREADMUTEXATR(3)

NAME
     pthreadmutexattrinit, pthreadmutexattrdestroy,
     pthreadmutexattrsetprioceiling, pthreadmutexattrgetprioceiling,
     pthreadmutexattrsetprotocol, pthreadmutexattrgetprotocol,
     pthreadmutexattrsettype, pthreadmutexattrgettype -- mutex attribute
     operations

SYNOPSIS
     ##include <>

     int
     pthreadmutexattrinit(pthreadmutexattrt *attr);

     int
     pthreadmutexattrdestroy(pthreadmutexattrt *attr);

     int
     pthreadmutexattrsetprioceiling(pthreadmutexattrt *attr,
         int prioceiling);

     int
     pthreadmutexattrgetprioceiling(pthreadmutexattrt *attr,
         int *prioceiling);

     int
     pthreadmutexattrsetprotocol(pthreadmutexattrt *attr, int protocol);

     int
     pthreadmutexattrgetprotocol(pthreadmutexattrt *attr, int *protocol);

     int
     pthreadmutexattrsettype(pthreadmutexattrt *attr, int type);

     int
     pthreadmutexattrgettype(pthreadmutexattrt *attr, int *type);

DESCRIPTION
     Mutex attributes are used to specify parameters to pthreadmutexinit().
     One attribute object can be used in multiple calls to
     pthreadmutexinit(), with or without modifications between calls.

     The pthreadmutexattrinit() function initializes attr with all the
     default mutex attributes.

     The pthreadmutexattrdestroy() function destroys attr.

     The pthreadmutexattrsettype() functions set the mutex type value of the
     attribute.  Valid mutex types are: PTHREADMUTEXNORMAL,
     PTHREADMUTEXERORCHECK, PTHREADMUTEXRECURSIVE, and
     PTHREADMUTEXDEFAULT.  The default mutex type for
     pthreadmutexaddrinit() 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.

     PTHREADMUTEXERORCHECK mutexes do check for usage errors.  If an
     attempt is made to relock a PTHREADMUTEXERORCHECK mutex without first
     dropping the lock an error will be returned.  If a thread attempts to
     unlock a PTHREADMUTEXERORCHECK mutex that is locked by another thread,
     an error will be returned.  If a thread attemps to unlock a
     PTHREADMUTEXERORCHECK 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.

     pthreadmutexattrgettype() functions copy the type value of the
     attribute to the location pointed to by the second parameter.

     The pthreadmutexattrset**() functions set the attribute that corresponds
     to each function name.

     The pthreadmutexattrget**() 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.

ERORS
     pthreadmutexattrinit() will fail if:

     [ENOMEM]           Out of memory.

     pthreadmutexattrdestroy() will fail if:

     [EINVAL]           Invalid value for attr.

     pthreadmutexattrsetprioceiling() will fail if:

     [EINVAL]           Invalid value for attr, or invalid value for
                        prioceiling.

     pthreadmutexattrgetprioceiling() will fail if:

     [EINVAL]           Invalid value for attr.

     pthreadmutexattrsetprotocol() will fail if:

     [EINVAL]           Invalid value for attr, or invalid value for protocol.

     pthreadmutexattrgetprotocol() will fail if:

     [EINVAL]           Invalid value for attr.

     pthreadmutexattrsettype() will fail if:

     [EINVAL]           Invalid value for attr, or invalid value for type.

     pthreadmutexattrgettype() will fail if:

     [EINVAL]           Invalid value for attr.

SEE ALSO
     pthreadmutexinit(3)

STANDARDS
     pthreadmutexattrinit() and pthreadmutexattrdestroy() conform to
     ISO/IEC 9945-1:1996 (``POSIX.1'')

     pthreadmutexattrsetprioceiling(), pthreadmutexattrgetprioceiling(),
     pthreadmutexattrsetprotocol(), pthreadmutexattrgetprotocol(),
     pthreadmutexattrsettype(), and pthreadmutexattrgettype() conform to
     Version 2 of the Single UNIX Specification (``SUSv2'')

BSD                            January 30, 2003                            BSD
Darwin Mac OS X man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™