diff options
author | Gregory Maxwell <greg@xiph.org> | 2016-11-29 09:46:19 +0000 |
---|---|---|
committer | Gregory Maxwell <greg@xiph.org> | 2016-12-03 07:17:34 +0000 |
commit | e3ba0ef95636290a3bb597ddd25d13ea13b034aa (patch) | |
tree | 41f2d20d968a2437bdde4ac3a3ded4700220fb4f /src/util.cpp | |
parent | c63198f1c787d69052d6332c5e52118f58eacf56 (diff) |
Eliminate data races for strMiscWarning and fLargeWork*Found.
This moves all access to these datastructures through accessor functions
and protects them with a lock.
Diffstat (limited to 'src/util.cpp')
-rw-r--r-- | src/util.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp index a2e6b85d29..92a5b34a3f 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -108,6 +108,7 @@ bool fDebug = false; bool fPrintToConsole = false; bool fPrintToDebugLog = true; +CCriticalSection cs_warnings; string strMiscWarning; bool fLargeWorkForkFound = false; bool fLargeWorkInvalidChainFound = false; @@ -813,6 +814,36 @@ std::string CopyrightHolders(const std::string& strPrefix) return strCopyrightHolders; } +void SetMiscWarning(const std::string& strWarning) +{ + LOCK(cs_warnings); + strMiscWarning = strWarning; +} + +void SetfLargeWorkForkFound(bool flag) +{ + LOCK(cs_warnings); + fLargeWorkForkFound = flag; +} + +bool GetfLargeWorkForkFound() +{ + LOCK(cs_warnings); + return fLargeWorkForkFound; +} + +void SetfLargeWorkInvalidChainFound(bool flag) +{ + LOCK(cs_warnings); + fLargeWorkInvalidChainFound = flag; +} + +bool GetfLargeWorkInvalidChainFound() +{ + LOCK(cs_warnings); + return fLargeWorkInvalidChainFound; +} + std::string GetWarnings(const std::string& strFor) { string strStatusBar; @@ -820,6 +851,8 @@ std::string GetWarnings(const std::string& strFor) string strGUI; const string uiAlertSeperator = "<hr />"; + LOCK(cs_warnings); + if (!CLIENT_VERSION_IS_RELEASE) { strStatusBar = "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"; strGUI = _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications"); |