51 Worker(std::string
const& _name =
"anon",
unsigned _idleWaitMs = 30): m_name(_name), m_idleWaitMs(_idleWaitMs) {}
67 void setName(std::string _n) {
if (!isWorking()) m_name = _n; }
85 virtual void workLoop();
100 unsigned m_idleWaitMs = 0;
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
void swap(dev::eth::Watch &_a, dev::eth::Watch &_b)
virtual void startedWorking()
Called after thread is started from startWorking().
Worker & operator=(Worker &&_m)
Move-assignment.
assert(len-trim+(2 *lenIndices)<=WIDTH)
Mutex x_work
Lock for the network existance.
Worker(std::string const &_name="anon", unsigned _idleWaitMs=30)
std::lock_guard< std::mutex > Guard
bool isWorking() const
Returns if worker thread is present.
std::unique_ptr< std::thread > m_work
The network thread.
void setName(std::string _n)
Allows changing worker name if work is stopped.
Worker(Worker &&_m)
Move-constructor.
virtual void doneWorking()
Called when is to be stopped, just prior to thread being joined.
virtual void doWork()
Called continuously following sleep for m_idleWaitMs.