Bitcoin ABC 0.30.5
P2P Digital Currency
|
A helper class for interruptible sleeps. More...
#include <threadinterrupt.h>
Public Member Functions | |
CThreadInterrupt () | |
operator bool () const | |
void | operator() () EXCLUSIVE_LOCKS_REQUIRED(!mut) |
void | reset () |
bool | sleep_for (std::chrono::milliseconds rel_time) EXCLUSIVE_LOCKS_REQUIRED(!mut) |
bool | sleep_for (std::chrono::seconds rel_time) EXCLUSIVE_LOCKS_REQUIRED(!mut) |
bool | sleep_for (std::chrono::minutes rel_time) EXCLUSIVE_LOCKS_REQUIRED(!mut) |
Private Attributes | |
std::condition_variable | cond |
Mutex | mut |
std::atomic< bool > | flag |
A helper class for interruptible sleeps.
Calling operator() will interrupt any current sleep, and after that point operator bool() will return true until reset.
Definition at line 20 of file threadinterrupt.h.
CThreadInterrupt::CThreadInterrupt | ( | ) |
Definition at line 8 of file threadinterrupt.cpp.
|
explicit |
Definition at line 10 of file threadinterrupt.cpp.
void CThreadInterrupt::operator() | ( | ) |
Definition at line 18 of file threadinterrupt.cpp.
void CThreadInterrupt::reset | ( | ) |
bool CThreadInterrupt::sleep_for | ( | std::chrono::milliseconds | rel_time | ) |
bool CThreadInterrupt::sleep_for | ( | std::chrono::minutes | rel_time | ) |
bool CThreadInterrupt::sleep_for | ( | std::chrono::seconds | rel_time | ) |
|
private |
Definition at line 34 of file threadinterrupt.h.
|
private |
Definition at line 36 of file threadinterrupt.h.
|
private |
Definition at line 35 of file threadinterrupt.h.