mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-09-01 10:51:28 +02:00
threading: use a reverse lock rather than manual critsect macros
No functional change.
This commit is contained in:
@@ -704,7 +704,7 @@ static RPCHelpMan getblocktemplate()
|
||||
NodeContext& node = EnsureAnyNodeContext(request.context);
|
||||
ChainstateManager& chainman = EnsureChainman(node);
|
||||
Mining& miner = EnsureMining(node);
|
||||
LOCK(cs_main);
|
||||
WAIT_LOCK(cs_main, csmain_lock);
|
||||
uint256 tip{CHECK_NONFATAL(miner.getTip()).value().hash};
|
||||
|
||||
std::string strMode = "template";
|
||||
@@ -810,8 +810,8 @@ static RPCHelpMan getblocktemplate()
|
||||
}
|
||||
|
||||
// Release lock while waiting
|
||||
LEAVE_CRITICAL_SECTION(cs_main);
|
||||
{
|
||||
REVERSE_LOCK(csmain_lock, cs_main);
|
||||
MillisecondsDouble checktxtime{std::chrono::minutes(1)};
|
||||
while (IsRPCRunning()) {
|
||||
// If hashWatchedChain is not a real block hash, this will
|
||||
@@ -830,8 +830,6 @@ static RPCHelpMan getblocktemplate()
|
||||
checktxtime = std::chrono::seconds(10);
|
||||
}
|
||||
}
|
||||
ENTER_CRITICAL_SECTION(cs_main);
|
||||
|
||||
tip = CHECK_NONFATAL(miner.getTip()).value().hash;
|
||||
|
||||
if (!IsRPCRunning())
|
||||
|
Reference in New Issue
Block a user