SYNOPSIS
SYNOPSIS#include <semaphore.h>
#include <time.h>
int sem_timedwait(sem_t *restrict sem, const struct timespec *restrict abs_timeout);
DESCRIPTION
The
The timeout expires after the amount of time specified by abs_timeout passes or if the specified amount of time has already passed at the time of the call.
The timespec data type is defined as a structure in the <time.h> header.
If the semaphore can be locked immediately, the abs_timeout argument is ignored.
PARAMETERS
- sem
-
Specifies the semaphore to be locked.
- abs_timeout
-
Specifies how long to wait for the semaphore to become unlocked by another thread or process.
RETURN VALUES
When successful, the
- EINTR
-
A signal interrupted this function.
- EINVAL
-
The sem argument is not a valid semaphore.
- EINVAL
-
The process or thread would have blocked, and the abs_timeout parameter specified a nanoseconds field value less than zero or greater than or equal to 1000 million.
- ETIMEDOUT
-
The semaphore could not be locked before the specified timeout expired.
EXAMPLES
None.
CONFORMANCE
UNIX 03. Derived from IEEEĀ StdĀ 1003.1d-1999.
MULTITHREAD SAFETY LEVEL
MT-Safe.
PORTING ISSUES
On the NuTCRACKER Platform, the timeout is handled by Win32 functions and is less precise
than on UNIX platforms.
On UNIX platforms with the Timers option supported,
the timeout is based on the CLOCK_REALTIME clock.
On UNIX platforms without the Timers option, the timeout is based
on the system clock as returned by the
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Functions:
sem_post() ,sem_trywait() ,sem_wait() ,semctl() ,semget() ,semop() ,time()
- Miscellaneous:
- semaphores
PTC MKS Toolkit 10.4 Documentation Build 39.