diff options
| author | Wladimir J. van der Laan <[email protected]> | 2018-08-31 17:23:47 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2018-08-31 17:33:21 +0200 |
| commit | 59ecacfc84af13e5a1608e7d970315d07dcb0269 (patch) | |
| tree | aeece6f0d62abfa11a70875d120350f0374cabee /src/init.cpp | |
| parent | Merge #11640: Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection (diff) | |
| parent | scripted-diff: Small locking rename (diff) | |
| download | discoin-59ecacfc84af13e5a1608e7d970315d07dcb0269.tar.xz discoin-59ecacfc84af13e5a1608e7d970315d07dcb0269.zip | |
Merge #11599: scripted-diff: Small locking rename
190bf62be1214b072513c7fd7e01cc191723967c scripted-diff: Small locking rename (Russell Yanofsky)
Pull request description:
Call sync.h primitives "locks" and "mutexes" instead of "blocks" and "waitable critical sections" to match current coding conventions and c++11 standard names.
This PR does not rename the "CCriticalSection" class (though this could be done as a followup) because it's used everywhere and would swamp the other changes in this PR. Plain mutexes should mostly be preferred instead of recursive mutexes in new code anyway.
Tree-SHA512: 39b5b2be8f7a98227be8ab0648bdbb1b620944659bdc1eb9a15b0fcc0c930457fa0c03170cfedaeee0007ea716c526b31a8d84a86dd2333ce9d8bfabd773fe45
Diffstat (limited to 'src/init.cpp')
| -rw-r--r-- | src/init.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/init.cpp b/src/init.cpp index 11b36a46e..27966319d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -561,17 +561,17 @@ static void BlockNotifyCallback(bool initialSync, const CBlockIndex *pBlockIndex } static bool fHaveGenesis = false; -static CWaitableCriticalSection cs_GenesisWait; -static CConditionVariable condvar_GenesisWait; +static Mutex g_genesis_wait_mutex; +static std::condition_variable g_genesis_wait_cv; static void BlockNotifyGenesisWait(bool, const CBlockIndex *pBlockIndex) { if (pBlockIndex != nullptr) { { - LOCK(cs_GenesisWait); + LOCK(g_genesis_wait_mutex); fHaveGenesis = true; } - condvar_GenesisWait.notify_all(); + g_genesis_wait_cv.notify_all(); } } @@ -1661,12 +1661,12 @@ bool AppInitMain() // Wait for genesis block to be processed { - WAIT_LOCK(cs_GenesisWait, lock); + WAIT_LOCK(g_genesis_wait_mutex, lock); // We previously could hang here if StartShutdown() is called prior to // ThreadImport getting started, so instead we just wait on a timer to // check ShutdownRequested() regularly. while (!fHaveGenesis && !ShutdownRequested()) { - condvar_GenesisWait.wait_for(lock, std::chrono::milliseconds(500)); + g_genesis_wait_cv.wait_for(lock, std::chrono::milliseconds(500)); } uiInterface.NotifyBlockTip_disconnect(BlockNotifyGenesisWait); } |