Fixed graceful shutdown.
This commit is contained in:
parent
9732636155
commit
a3988374f0
15 changed files with 62 additions and 4 deletions
|
@ -161,6 +161,12 @@ void Hashrate::print()
|
|||
}
|
||||
|
||||
|
||||
void Hashrate::stop()
|
||||
{
|
||||
uv_timer_stop(&m_timer);
|
||||
}
|
||||
|
||||
|
||||
void Hashrate::updateHighest()
|
||||
{
|
||||
double highest = calc(2500);
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
double calc(size_t threadId, size_t ms) const;
|
||||
void add(size_t threadId, uint64_t count, uint64_t timestamp);
|
||||
void print();
|
||||
void stop();
|
||||
void updateHighest();
|
||||
|
||||
inline double highest() const { return m_highest; }
|
||||
|
|
|
@ -115,6 +115,15 @@ void Workers::start(int64_t affinity)
|
|||
}
|
||||
|
||||
|
||||
void Workers::stop()
|
||||
{
|
||||
uv_timer_stop(&m_timer);
|
||||
m_hashrate->stop();
|
||||
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&m_async), nullptr);
|
||||
}
|
||||
|
||||
|
||||
void Workers::submit(const JobResult &result)
|
||||
{
|
||||
uv_mutex_lock(&m_mutex);
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
static void setEnabled(bool enabled);
|
||||
static void setJob(const Job &job);
|
||||
static void start(int64_t affinity);
|
||||
static void stop();
|
||||
static void submit(const JobResult &result);
|
||||
|
||||
static inline bool isEnabled() { return m_enabled; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue