6#include <util/threadinterrupt.h>
14 return flag.load(std::memory_order_acquire);
17CThreadInterrupt::operator bool()
const
24 flag.store(
false, std::memory_order_release);
31 flag.store(
true, std::memory_order_release);
39 return !
cond.wait_for(lock, rel_time, [
this]() {
return flag.load(std::memory_order_acquire); });
virtual void operator()() EXCLUSIVE_LOCKS_REQUIRED(!mut)
Interrupt any sleeps. After this interrupted() will return true.
virtual void reset()
Reset to an non-interrupted state.
virtual bool sleep_for(Clock::duration rel_time) EXCLUSIVE_LOCKS_REQUIRED(!mut)
Sleep for the given duration.
virtual bool interrupted() const
Return true if operator()() has been called.
std::condition_variable cond
#define WAIT_LOCK(cs, name)