Index of Section 2 Manual Pages

Interix / SUAsem_getvalue.2Interix / SUA

sem_getvalue(2)                                         sem_getvalue(2)

  sem_getvalue()

  NAME

    sem_getvalue() - get the value of a semaphore

  SYNOPSIS

    #include 

    int sem_getvalue(sem_t *sem, int *sval);

  DESCRIPTION

    The sem_getvalue(2) function stores the value of the semaphore referenced
    by the sem argument in the location referenced by the sval argument
    without affecting the state of the semaphore. Although this value may
    represent the value of the semaphore after the function was called but
    before it returns, it is not necessarily the value of the semaphore when
    the function actually returns.

    If the semaphore is locked, then the value stored in sval is set to a
    negative number, the absolute value of which represents the number of
    processes waiting for the semaphore at some time between when the function
    was called and when it returns.

  RETURN VALUES

    On success, the function returns 0; otherwise, -1 is returned and errno is
    set to an error code to indicate the error.

  ERRORS

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

    [EINVAL]
        The sem argument does not refer to a valid semaphore.

  SEE ALSO

    semctl(2)

    semget(2)

    semop(2)

    sem_post(2)

    sem_timedwait(2)

    sem_trywait(2)

    sem_wait(2)

  USAGE NOTES

    The sem_getvalue function is thread safe.

    The sem_getvalue function is not async-signal safe.


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