Platform API Reference
Platform portability layer
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.
IotSemaphore_t
_IotSystemSemaphore_t IotSemaphore_t
The type used to represent semaphores, configured with the type _IotSystemSemaphore_t.
Definition: iot_platform_types.h:97
IotSemaphore_TryWait
bool IotSemaphore_TryWait(IotSemaphore_t *pSemaphore)
Attempt to wait on (lock) a semaphore. Return immediately if the semaphore is not available.