Botan
1.11.15
|
#include <semaphore.h>
Public Member Functions | |
void | acquire () |
void | release (size_t n=1) |
Semaphore (int value=0) |
Definition at line 16 of file semaphore.h.
Botan::Semaphore::Semaphore | ( | int | value = 0 | ) | [inline] |
Definition at line 19 of file semaphore.h.
: m_value(value), m_wakeups(0) {}
void Botan::Semaphore::acquire | ( | ) |
Definition at line 30 of file semaphore.cpp.
{ std::unique_lock<std::mutex> lock(m_mutex); --m_value; if(m_value < 0) { m_cond.wait(lock, [this] { return m_wakeups > 0; }); --m_wakeups; } }
void Botan::Semaphore::release | ( | size_t | n = 1 | ) |
Definition at line 14 of file semaphore.cpp.
References n.