Index of Section 2 Manual Pages

Interix / SUApthread_mutexattr_settype.2Interix / SUA

pthread_mutexattr_settype(2)               pthread_mutexattr_settype(2)

  pthread_mutexattr_gettype()

  NAME

    pthread_mutexattr_gettype(), pthread_mutexattr_settype() - get or set the
    type attribute in a mutex attributes object

  SYNOPSIS

    #include 

    int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *kind);
    int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind);

  DESCRIPTION

    The pthread_mutexattr_settype(2) function sets the type attribute in the
    mutex attribute object referenced by the attr argument using the value of
    the kind argument.

    When the mutex is created with the type attribute set to
    PTHREAD_MUTEX_NORMAL, functions that attempt to lock the mutex do not
    attempt to detect a deadlock condition caused by an attempt to lock an
    already locked mutex. If a thread attempts to unlock a thread that is not
    unlocked or that it did not lock, the results will be unpredictable.

    Error checking is provided if the type attribute is set to
    PTHREAD_MUTEX_ERRORCHECK, and functions that attempt to lock the mutex
    will return an error if an attempt is made to lock a mutex that is already
    locked. An error occurs if a thread attempts to unlock a thread that is
    not unlocked or that it has not locked.

    When the type attribute is set to PTHREAD_MUTEX_RECURSIVE, the mutex
    maintains a lock count. The first time a thread locks a mutex, the lock
    count is set to 1 (one). Each time a thread locks the mutex, the lock
    count is incremented by one, and each time a thread unlocks the mutex, the
    lock count is decremented by one. When the lock count reaches zero, the
    mutex becomes available to other threads for use. An error occurs if a
    thread attempts to unlock a thread that is not unlocked or that it has not
    locked.

    If the type attribute is set to PTHREAD_MUTEX_DEFAULT, attempting to lock
    a mutex that is already locked will produce unexpected results.

    The pthread_mutexattr_gettype(2) function retrieves the mutex type
    attribute from the mutex attributes object referenced by the attr argument
    and stores the value in the location referenced by the kind argument.

  RETURN VALUES

    On success, the function returns 0; otherwise, an error code is returned.

  ERRORS

    The pthread_mutexattr_settype() function can fail for the following
    reason:

    [EINVAL]
        The value specified by type is invalid.

    Both functions can fail for the following reason:

    [EINVAL]
        The attr argument does not refer to a valid mutex attributes object.

    Neither function returns [EINTR].

  SEE ALSO

    pthread_cond_destroy(2)

    pthread_create(2)

    pthread_mutex_destroy(2)

    pthread_mutexattr_destroy(2)

  USAGE NOTES

    All of these functions are thread safe.

    None of these functions are async-signal safe.


Interix / SUAHosted at SUA Community for Interix, SUA and SFUInterix / SUA