 |
Ethereum
PoC-8
The C++ Implementation of Ethereum
|
Go to the documentation of this file.
51 Worker(std::string
const& _name =
"anon",
unsigned _idleWaitMs = 30): m_name(_name), m_idleWaitMs(_idleWaitMs) {}
103 unsigned m_idleWaitMs = 0;
105 mutable Mutex x_work;
106 std::unique_ptr<std::thread> m_work;
107 mutable std::condition_variable m_state_notifier;
void setName(std::string _n)
Allows changing worker name if work is stopped.
void stopWorking()
Stop worker thread; causes call to stopWorking().
Worker & operator=(Worker &&_m)
Move-assignment.
std::lock_guard< std::mutex > Guard
void swap(dev::eth::Watch &_a, dev::eth::Watch &_b)
virtual void startedWorking()
Called after thread is started from startWorking().
virtual void workLoop()
Overrides doWork(); should call shouldStop() often and exit when true.
virtual void doWork()
Called continuously following sleep for m_idleWaitMs.
Worker(Worker &&_m)
Move-constructor.
virtual void doneWorking()
Called when is to be stopped, just prior to thread being joined.
void startWorking()
Starts worker thread; causes startedWorking() to be called.
Worker(std::string const &_name="anon", unsigned _idleWaitMs=30)
bool isWorking() const
Returns if worker thread is present.
void terminate()
Blocks caller into worker thread has finished.