12 #include <condition_variable>
32 std::unique_lock<std::mutex> lock(mutex);
36 [
this] {
return wakeups > 0; });
44 std::unique_lock<std::mutex> lock(mutex);
47 std::chrono::duration<double> ctime(timeout);
48 cond.wait_for(lock, ctime, [
this] {
return wakeups > 0; });
62 std::unique_lock<std::mutex> lock(mutex);
73 std::lock_guard<std::mutex> lock(mutex);
83 std::condition_variable cond;
89 Semaphore::Semaphore(
unsigned int initialCount) :
90 mPriv(new
Private(initialCount))
106 return mPriv->waitWithTimeout(timeoutInSeconds);
111 return mPriv->check();