5 :m_release(releaseFlag),
15 std::unique_lock<std::mutex> lock(m_mutex);
18 m_conditionalWait.wait(lock, [
this]{
return m_waitCount.load()<1;});
26 std::unique_lock<std::mutex> lock(m_mutex);
28 m_release = releaseFlag;
30 m_conditionVariable.notify_all();
35 std::unique_lock<std::mutex> lock(m_mutex);
39 m_conditionVariable.wait(lock, [
this]{
40 return (m_release.load() ==
true);
43 if(m_waitCount < 0) m_waitCount = 0;
45 m_conditionVariable.notify_all();
46 m_conditionalWait.notify_all();
51 std::unique_lock<std::mutex> lock(m_mutex);
55 m_conditionVariable.wait_for(lock,
56 std::chrono::milliseconds(waitTimeMillis),
58 return (m_release.load() ==
true);
61 if(m_waitCount < 0) m_waitCount = 0;
63 m_conditionVariable.notify_all();
64 m_conditionalWait.notify_all();
69 std::unique_lock<std::mutex> lock(m_mutex);
74 m_conditionVariable.notify_all();
80 std::unique_lock<std::mutex> lock(m_mutex);
void set(bool releaseFlag)
Will set the relase flag and wake up all threads to test the condition again.
void release()
Releases the threads and will not return until all threads are released.
unsigned long long ossim_uint64
void block()
Will block the calling thread based on the internal condition.
Block(bool releaseFlag=false)
Allows one the construct a Block with a release state.
void reset()
Simple reset the values.