sem_timedwait

Name

sem_timedwait -- lock a semaphore with a timeout

Synopsis

       #include <semaphore.h>

       int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout);

DESCRIPTION

The sem_timedwait function locks the semaphore referenced by sem like sem_wait. If the semaphore is not locked at the time specified by the abs_timeout, sem_timedwait returns with the ETIMEDOUT error. The absolute timeout is expressed with respect to the CLOCK_REALTIME clock.

RETURN VALUE

On success, zero is returned. On error, -1 is returned, and errno is set appropriately.

ERRORS

All error values of sem_wait apply. In addition, the following errors defined.

ETIMEDOUT

The semaphore lock operation timed out.

AUTHOR

Michael Barabanov (baraban@fsmlabs.com)

SEE ALSO

sem_wait(3), clock_gettime(3)

©2001 FSMLabs Inc.

All rights reserved.