10#include <condition_variable>
70 std::unique_lock<std::mutex> lock(
_mtx);
86 void open(
bool okay =
true)
88 std::unique_lock<std::mutex> lock(
_mtx);
99 std::unique_lock<std::mutex> lock(
_mtx);
Thread fence synchronization utility class.
std::mutex _mtx
the internal mutex
void open(bool okay=true)
Open the fence and notify all waiting threads.
bool wait()
Wait for the fence to be opened.
ThreadFence & operator=(const ThreadFence &)=delete
delete copy-assignment operator
bool _open
current state of the fence: open or closed
std::condition_variable _cvar
the internal condition variable
ThreadFence(const ThreadFence &)=delete
delete copy-constructor
bool _okay
additional state variable
void close()
Close the fence and reset internal state.