mirror of
https://github.com/FairRootGroup/FairLogger.git
synced 2025-10-13 16:46:46 +00:00
guard localtime with a mutex to avoid race
This commit is contained in:
parent
63820e5f2c
commit
0700886b37
|
@ -575,10 +575,13 @@ void Logger::RemoveCustomSink(const string& key)
|
|||
Logger& Logger::Log()
|
||||
{
|
||||
char tsstr[32];
|
||||
{
|
||||
lock_guard<mutex> lock(fMtx); // localtime is not threadsafe, guard it
|
||||
if (!strftime(tsstr, sizeof(tsstr), "%H:%M:%S", localtime(&(fMetaData.timestamp))))
|
||||
{
|
||||
tsstr[0] = 'u';
|
||||
}
|
||||
}
|
||||
|
||||
if ((!fColored && LoggingToConsole()) || LoggingToFile())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user