/sys$common/syshlp/HELPLIB.HLB  —  POSIX Threads, TIS routines, tis_mutex_init
    Initializes the specified mutex object.

1  –  C Binding

    #include <tis.h>

    int
    tis_mutex_init (
                pthread_mutex_t   *mutex );

2  –  Arguments

 mutex

    Pointer to a mutex object (passed by reference) to be
    initialized.

3  –  Description

    This routine initializes a mutex object with the Threads Library
    default mutex attributes. A mutex is a synchronization object
    that allows multiple threads to serialize their access to shared
    data.

    The mutex object is initialized and set to the unlocked state.

    Your program can use the PTHREAD_MUTEX_INITIALIZER macro to
    statically initialize a mutex object without calling this
    routine. Static initialization can be used only for a condition
    variable with storage class "extern" or "static" - "automatic"
    (stack local) objects must be initialized by calling tis_mutex_
    init(). Use this macro as follows:

       pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

4  –  Return Values

    If an error condition occurs, this routine returns an integer
    value indicating the type of error. Possible return values are as
    follows:

    Return      Description

    0           Successful completion.
    [EAGAIN]    The system lacks the necessary resources to
                initialize a mutex.
    [EBUSY]     The implementation has detected an attempt to
                reinitialize mutex (a previously initialized, but
                not yet destroyed, mutex).
    [EINVAL]    The value specified by mutex is not a valid mutex.
    [ENOMEM]    Insufficient memory to initialize the mutex.
    [EPERM]     The caller does not have privileges to perform this
                operation.

5  –  Associated Routines

       tis_mutex_destroy()
       tis_mutex_lock()
       tis_mutex_trylock()
       tis_mutex_unlock()
Close Help