fixed: FileLog::get_local_date we need to synchronize when using time_zones pointer
(FileLog::get_local_date is used by Log::PrintDate() and Log of course can be used from different threads) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1218 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
be81307faa
commit
e95f32231a
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2018, Tomasz Sowa
|
||||
* Copyright (c) 2018-2019, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -95,6 +95,7 @@ PT::Date FileLog::get_local_date(const PT::Date & date)
|
|||
{
|
||||
if( time_zones )
|
||||
{
|
||||
Lock lock(synchro);
|
||||
TimeZone * tz = time_zones->GetZone(log_time_zone_id);
|
||||
|
||||
if( tz )
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* Copyright (c) 2008-2019, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -77,7 +77,7 @@ void Log::PrintDate(const PT::Date & date)
|
|||
FileLog * winix_file_log = dynamic_cast<FileLog*>(file_log);
|
||||
|
||||
if( winix_file_log )
|
||||
(*this) << winix_file_log->get_local_date(date);
|
||||
(*this) << winix_file_log->get_local_date(date); // synchronization is made in get_local_date
|
||||
else
|
||||
(*this) << date;
|
||||
}
|
||||
|
@ -250,17 +250,18 @@ return *this;
|
|||
}
|
||||
|
||||
|
||||
Log & Log::SystemErr(int err)
|
||||
{
|
||||
(*this) << "errno: " << err;
|
||||
|
||||
const char * err_msg = strerror(err);
|
||||
|
||||
if( err_msg )
|
||||
(*this) << " (" << err_msg << ")";
|
||||
|
||||
return *this;
|
||||
}
|
||||
//Log & Log::SystemErr(int err)
|
||||
//{
|
||||
// (*this) << "errno: " << err;
|
||||
//
|
||||
// // strerror is not thread safe and we now use Log in each thread
|
||||
// const char * err_msg = strerror(err);
|
||||
//
|
||||
// if( err_msg )
|
||||
// (*this) << " (" << err_msg << ")";
|
||||
//
|
||||
// return *this;
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008-2018, Tomasz Sowa
|
||||
* Copyright (c) 2008-2019, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
virtual Log & LogBinary(const char * blob, size_t blob_len);
|
||||
virtual Log & LogBinary(const std::string & blob);
|
||||
|
||||
virtual Log & SystemErr(int err);
|
||||
//virtual Log & SystemErr(int err);
|
||||
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in New Issue