diff options
| author | Matt Corallo <[email protected]> | 2016-11-27 15:11:49 -0800 |
|---|---|---|
| committer | Matt Corallo <[email protected]> | 2016-11-27 15:36:44 -0800 |
| commit | 507145d78595e052ce13368e122f72c85093992c (patch) | |
| tree | 5e4039d86ce050646522c7f4f363f243b710ce91 /src/utiltime.cpp | |
| parent | Merge #9128: net: Decouple CConnman and message serialization (diff) | |
| download | discoin-507145d78595e052ce13368e122f72c85093992c.tar.xz discoin-507145d78595e052ce13368e122f72c85093992c.zip | |
Fix race when accessing std::locale::classic()
See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78552
Diffstat (limited to 'src/utiltime.cpp')
| -rw-r--r-- | src/utiltime.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utiltime.cpp b/src/utiltime.cpp index da590f888..51d545ef8 100644 --- a/src/utiltime.cpp +++ b/src/utiltime.cpp @@ -74,8 +74,9 @@ void MilliSleep(int64_t n) std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime) { + static std::locale classic(std::locale::classic()); // std::locale takes ownership of the pointer - std::locale loc(std::locale::classic(), new boost::posix_time::time_facet(pszFormat)); + std::locale loc(classic, new boost::posix_time::time_facet(pszFormat)); std::stringstream ss; ss.imbue(loc); ss << boost::posix_time::from_time_t(nTime); |