wait for miner threads to exit (join them)

This commit is contained in:
Larry Ruane 2018-10-30 15:41:30 -06:00
parent ab24201507
commit a17646b1fd
1 changed files with 4 additions and 2 deletions

View File

@ -640,10 +640,11 @@ void static BitcoinMiner()
LogPrintf("ZcashMiner:\n");
LogPrintf("proof-of-work found \n hash: %s \ntarget: %s\n", pblock->GetHash().GetHex(), hashTarget.GetHex());
#ifdef ENABLE_WALLET
if (ProcessBlockFound(pblock, *pwallet, reservekey)) {
if (ProcessBlockFound(pblock, *pwallet, reservekey))
#else
if (ProcessBlockFound(pblock)) {
if (ProcessBlockFound(pblock))
#endif
{
// Ignore chain updates caused by us
std::lock_guard<std::mutex> lock{m_cs};
cancelSolver = false;
@ -767,6 +768,7 @@ void GenerateBitcoins(bool fGenerate, int nThreads)
if (minerThreads != NULL)
{
minerThreads->interrupt_all();
minerThreads->join_all();
delete minerThreads;
minerThreads = NULL;
}