14 long value =
static_cast<long>(initial_count);
15 this->m_handle.
m_semaphore = dispatch_semaphore_create(value);
25 dispatch_semaphore_signal(this->m_handle.
m_semaphore);
33 long result = dispatch_semaphore_wait(this->m_handle.
m_semaphore, DISPATCH_TIME_FOREVER);
34 FW_ASSERT(result == 0, static_cast<FwAssertArgType>(result));
41 int64_t nsec =
static_cast<int64_t
>(interval.
getSeconds()) * 1000000000LL +
42 static_cast<int64_t>(interval.
getUSeconds()) * 1000LL;
43 dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, nsec);
44 long result = dispatch_semaphore_wait(this->m_handle.
m_semaphore, timeout);
51 long result = dispatch_semaphore_wait(this->m_handle.
m_semaphore, DISPATCH_TIME_NOW);
59 (void)dispatch_semaphore_signal(this->m_handle.
m_semaphore);
Status tryWait() override
non-blocking attempt to decrement the semaphore
dispatch_semaphore_t m_semaphore
Status waitTimeout(const Fw::TimeInterval &interval) override
wait on the semaphore with a timeout
CountingSemaphoreHandle * getHandle() override
return the underlying semaphore handle (implementation specific)
Status post() override
post (increment) the semaphore, potentially waking a waiting thread
DarwinCountingSemaphore(U32 initial_count)
Os::CountingSemaphore::Status dispatch_result_to_semaphore_status(long dispatch_result)
Status wait() override
wait (decrement) the semaphore, blocking if count is zero
~DarwinCountingSemaphore() override