AWS IoT Device SDK C: Platform
Platform portability layer
Return to main page ↑
IotSemaphore_TryWait

Attempt to wait on (lock) a semaphore. Return immediately if the semaphore is not available.

bool IotSemaphore_TryWait( IotSemaphore_t * pSemaphore );

If the count of pSemaphore is positive, this function immediately decrements the semaphore and returns. Otherwise, this function returns without decrementing pSemaphore.

Parameters
[in]pSemaphoreThe semaphore to lock.
Returns
true if the semaphore wait succeeded; false if the semaphore has a count of 0.
See also
IotSemaphore_Wait for a blocking wait; IotSemaphore_TimedWait for a wait with timeout.