fix(TZInfo): Static FastMutex fails to lock when issued from another thread on linux #3918

This commit is contained in:
Alex Fabijanic 2023-01-23 08:06:55 +01:00
parent 091c1af26a
commit feee864950

View File

@ -14,7 +14,7 @@
#include "Poco/Timezone.h" #include "Poco/Timezone.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include "Poco/Mutex.h" #include <mutex>
#include <ctime> #include <ctime>
@ -31,7 +31,7 @@ public:
int timeZone() int timeZone()
{ {
Poco::FastMutex::ScopedLock lock(_mutex); std::lock_guard<std::mutex> lock(_mutex);
#if defined(__APPLE__) || defined(__FreeBSD__) || defined (__OpenBSD__) || POCO_OS == POCO_OS_ANDROID // no timezone global var #if defined(__APPLE__) || defined(__FreeBSD__) || defined (__OpenBSD__) || POCO_OS == POCO_OS_ANDROID // no timezone global var
std::time_t now = std::time(NULL); std::time_t now = std::time(NULL);
@ -50,14 +50,14 @@ public:
const char* name(bool dst) const char* name(bool dst)
{ {
Poco::FastMutex::ScopedLock lock(_mutex); std::lock_guard<std::mutex> lock(_mutex);
tzset(); tzset();
return tzname[dst ? 1 : 0]; return tzname[dst ? 1 : 0];
} }
private: private:
Poco::FastMutex _mutex; std::mutex _mutex;
}; };