15 #ifndef A_UTIL_UTIL_CONCURRENCY_DETAIL_SEMAPHORE_DECL_HEADER_INCLUDED
16 #define A_UTIL_UTIL_CONCURRENCY_DETAIL_SEMAPHORE_DECL_HEADER_INCLUDED
21 namespace concurrency {
30 template <
typename Mutex,
typename CondVar>
62 template <
typename Rep,
typename Period>
63 bool wait_for(
const std::chrono::duration<Rep, Period>& timeout);
Semaphore implementation, combining a mutex and a condition variable to manage a counter.
void notify()
Increment the counter and notify any waiters.
bool is_set()
Check whether the counter is set.
int _lock_count
The lock count.
void wait()
Decrement the counter, blocks until the count becomes non-zero (if neccessary)
void reset()
Reset the counter to 0.
Mutex _mutex
The mutex to handle.
CondVar _cv
The condition variable used to handle the notifications.
bool try_wait()
Try decrementing the counter.
bool wait_for(const std::chrono::duration< Rep, Period > &timeout)
Wait for a specified duration of time and decrement the counter afterwards.
Serves as the root component, with common functionality documented in core functionality.
Semapore implementation file.