Fix Windows shutdown hang and register console ctrl handler
- Remove GenerateBitcoins(false) from stop RPC handler because it calls minerThreads->join_all() which blocks the RPC thread, preventing the response from being sent back to the client. Miners are already stopped in Shutdown() so this was redundant. - Add ShutdownRequested() checks in miner peer-wait and nonce loops - Register SetConsoleCtrlHandler on Windows for clean Ctrl+C/close - Add check_and_clean_target for --linux-release builds
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include "RandomX/src/randomx.h"
|
||||
#endif
|
||||
#include "hash.h"
|
||||
#include "init.h"
|
||||
#include "key_io.h"
|
||||
#include "main.h"
|
||||
#include "metrics.h"
|
||||
@@ -1302,6 +1303,8 @@ void static RandomXMiner()
|
||||
}
|
||||
if (!fvNodesEmpty )//&& !IsInitialBlockDownload())
|
||||
break;
|
||||
if (ShutdownRequested())
|
||||
throw boost::thread_interrupted();
|
||||
MilliSleep(15000);
|
||||
//fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,SMART_CHAIN_SYMBOL,(int32_t)IsInitialBlockDownload());
|
||||
|
||||
@@ -1570,6 +1573,8 @@ void static RandomXMiner()
|
||||
}
|
||||
|
||||
boost::this_thread::interruption_point();
|
||||
if (ShutdownRequested())
|
||||
throw boost::thread_interrupted();
|
||||
|
||||
if (vNodes.empty() && chainparams.MiningRequiresPeers())
|
||||
{
|
||||
@@ -1702,6 +1707,8 @@ void static BitcoinMiner()
|
||||
}
|
||||
if (!fvNodesEmpty )//&& !IsInitialBlockDownload())
|
||||
break;
|
||||
if (ShutdownRequested())
|
||||
throw boost::thread_interrupted();
|
||||
MilliSleep(15000);
|
||||
//fprintf(stderr,"fvNodesEmpty %d IsInitialBlockDownload(%s) %d\n",(int32_t)fvNodesEmpty,SMART_CHAIN_SYMBOL,(int32_t)IsInitialBlockDownload());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user