diff options
| author | Wladimir J. van der Laan <[email protected]> | 2016-12-01 11:47:39 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2016-12-01 11:47:47 +0100 |
| commit | c79e52ad304a02cb66c66cfee49c9b82b458e769 (patch) | |
| tree | a663bd9df23c6ca75fc6abe0f12da712929ddc7a /src/util.cpp | |
| parent | Merge #9226: Remove fNetworkNode and pnodeLocalHost. (diff) | |
| parent | Make fStartedNewLine an std::atomic_bool (diff) | |
| download | discoin-c79e52ad304a02cb66c66cfee49c9b82b458e769.tar.xz discoin-c79e52ad304a02cb66c66cfee49c9b82b458e769.zip | |
Merge #9230: Fix some benign races in timestamp logging
8b22efb Make fStartedNewLine an std::atomic_bool (Matt Corallo)
507145d Fix race when accessing std::locale::classic() (Matt Corallo)
Diffstat (limited to 'src/util.cpp')
| -rw-r--r-- | src/util.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util.cpp b/src/util.cpp index 332e07762..014013d21 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -258,7 +258,7 @@ bool LogAcceptCategory(const char* category) * suppress printing of the timestamp when multiple calls are made that don't * end in a newline. Initialize it to true, and hold it, in the calling context. */ -static std::string LogTimestampStr(const std::string &str, bool *fStartedNewLine) +static std::string LogTimestampStr(const std::string &str, std::atomic_bool *fStartedNewLine) { string strStamped; @@ -285,7 +285,7 @@ static std::string LogTimestampStr(const std::string &str, bool *fStartedNewLine int LogPrintStr(const std::string &str) { int ret = 0; // Returns total number of characters written - static bool fStartedNewLine = true; + static std::atomic_bool fStartedNewLine(true); string strTimestamped = LogTimestampStr(str, &fStartedNewLine); |