VMS Help  —  POSIX Threads, TIS routines, tis_cond_init
    Initializes a condition variable.

1  –  C Binding

    #include <tis.h>

    int
    tis_cond_init (
                pthread_cond_t   *cond);

2  –  Arguments

 cond

    Address of the condition variable (passed by reference) to be
    initialized.

3  –  Description

    This routine initializes a condition variable (cond) with the
    Threads Library default condition variable attributes.

    A condition variable is a synchronization object used with a
    mutex. A mutex controls access to shared data. When threads are
    present, a condition variable allows threads to wait for data to
    enter a defined state.

    For more information about actions taken when threads are
    present, refer to the pthread_cond_init() description.

    Your program can use the macro PTHREAD_COND_INITIALIZER to
    initialize statically allocated condition variables to the
    default condition variable attributes. 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_cond_init(). Use this macro as
    follows:

       pthread_cond_t condition = PTHREAD_COND_INITIALIZER;

    When statically initialized, a condition variable should not also
    be initialized using tis_cond_init().

4  –  Return Values

    If there is an error condition, the following occurs:

    o  The routine returns an integer value indicating the type of
       error.

    o  The condition variable is not initialized.

    o  The contents of condition variable cond are undefined.

    The possible return values are as follows:

    Return      Description

    0           Successful completion.
    [EAGAIN]    The system lacks the necessary resources to
                initialize another condition variable, or

                The system-imposed limit on the total number of
                condition variables under execution by a single user
                is exceeded.
    [EBUSY]     The implementation has detected an attempt to
                reinitialize the object referenced by cond, a
                previously initialized, but not yet destroyed
                condition variable.
    [EINVAL]    The value specified by cond is not a valid condition
                variable.
    [ENOMEM]    Insufficient memory to initialize the condition
                variable.

5  –  Associated Routines

       tis_cond_broadcast()
       tis_cond_destroy()
       tis_cond_signal()
       tis_cond_wait()
Close Help