|SEM_WAIT(2)||System Calls Manual||SEM_WAIT(2)|
sem_trywait, sem_wait —
lock a semaphore
The semaphore referenced by sem is locked.
if the semaphore's value is zero, the calling thread will block until the
lock is acquired or until the call is interrupted by a signal.
function will fail if the semaphore is already locked, rather than blocking
on the semaphore.
sem_trywait() succeed unless:
Applications may encounter a priority inversion while using semaphores. When a thread is waiting on a semaphore which is about to be posted by a lower-priority thread and the lower-priority thread is preempted by another thread (of medium priority), a priority inversion has occured, and the higher-priority thread will be blocked for an unlimited time period. Programmers using the realtime functionality of the system should take care to avoid priority inversions.
sem_trywait() are specified in the POSIX Realtime
|June 8, 2000||Darwin|