18 unsigned int initialCount,
28 std::unique_lock<decltype(m_mutex)> lck(
m_mutex);
31 if (std::cv_status::timeout==
m_condition.wait_for(lck, std::chrono::milliseconds(timeout_ms)))
45 std::unique_lock<decltype(m_mutex)> lck(
m_mutex);
bool waitForSignal(unsigned int timeout_ms=0)
Blocks until the count of the semaphore to be non-zero.
void release(unsigned int increaseCount=1)
Increments the count of the semaphore by a given amount.
This namespace provides multitask, synchronization utilities.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::condition_variable m_condition
CSemaphore(unsigned int initialCount, unsigned int maxCount)
Creates a semaphore.