mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
refactor: Add lock annotations to Active* methods
This is a refactor, putting the burden to think about thread safety to the caller. Otherwise, there is a risk that the caller will assume thread safety where none exists, as is evident in the previous two commits.
This commit is contained in:
parent
fac15ff673
commit
fac04cb6ba
11 changed files with 44 additions and 28 deletions
|
|
@ -1547,7 +1547,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
|
|||
// Either install a handler to notify us when genesis activates, or set fHaveGenesis directly.
|
||||
// No locking, as this happens before any background thread is started.
|
||||
boost::signals2::connection block_notify_genesis_wait_connection;
|
||||
if (chainman.ActiveChain().Tip() == nullptr) {
|
||||
if (WITH_LOCK(chainman.GetMutex(), return chainman.ActiveChain().Tip() == nullptr)) {
|
||||
block_notify_genesis_wait_connection = uiInterface.NotifyBlockTip_connect(std::bind(BlockNotifyGenesisWait, std::placeholders::_2));
|
||||
} else {
|
||||
fHaveGenesis = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue