threading: use a reverse lock rather than manual critsect macros
No functional change.
This commit is contained in:
1 parent
3ddd554d31
commit
0d0e0a39b4
1 file changed
+2
-4
+2
-4
@@ -704,7 +704,7 @@ static RPCHelpMan getblocktemplate()
|
|||||||
NodeContext& node = EnsureAnyNodeContext(request.context);
|
NodeContext& node = EnsureAnyNodeContext(request.context);
|
||||||
ChainstateManager& chainman = EnsureChainman(node);
|
ChainstateManager& chainman = EnsureChainman(node);
|
||||||
Mining& miner = EnsureMining(node);
|
Mining& miner = EnsureMining(node);
|
||||||
LOCK(cs_main);
|
WAIT_LOCK(cs_main, csmain_lock);
|
||||||
uint256 tip{CHECK_NONFATAL(miner.getTip()).value().hash};
|
uint256 tip{CHECK_NONFATAL(miner.getTip()).value().hash};
|
||||||
|
|
||||||
std::string strMode = "template";
|
std::string strMode = "template";
|
||||||
@@ -810,8 +810,8 @@ static RPCHelpMan getblocktemplate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Release lock while waiting
|
// Release lock while waiting
|
||||||
LEAVE_CRITICAL_SECTION(cs_main);
|
|
||||||
{
|
{
|
||||||
|
REVERSE_LOCK(csmain_lock, cs_main);
|
||||||
MillisecondsDouble checktxtime{std::chrono::minutes(1)};
|
MillisecondsDouble checktxtime{std::chrono::minutes(1)};
|
||||||
while (IsRPCRunning()) {
|
while (IsRPCRunning()) {
|
||||||
// If hashWatchedChain is not a real block hash, this will
|
// If hashWatchedChain is not a real block hash, this will
|
||||||
@@ -830,8 +830,6 @@ static RPCHelpMan getblocktemplate()
|
|||||||
checktxtime = std::chrono::seconds(10);
|
checktxtime = std::chrono::seconds(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ENTER_CRITICAL_SECTION(cs_main);
|
|
||||||
|
|
||||||
tip = CHECK_NONFATAL(miner.getTip()).value().hash;
|
tip = CHECK_NONFATAL(miner.getTip()).value().hash;
|
||||||
|
|
||||||
if (!IsRPCRunning())
|
if (!IsRPCRunning())
|
||||||
|
|||||||
Reference in new issue
Block a user