mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 19:10:20 +01:00
GH #282: Using Thread in a global can cause crash on Windows
This commit is contained in:
@@ -145,14 +145,18 @@ std::string Thread::makeName()
|
|||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
|
{
|
||||||
|
FastMutex& getUniqueIdMutex()
|
||||||
{
|
{
|
||||||
static FastMutex uniqueIdMutex;
|
static FastMutex uniqueIdMutex;
|
||||||
|
return uniqueIdMutex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Thread::uniqueId()
|
int Thread::uniqueId()
|
||||||
{
|
{
|
||||||
FastMutex::ScopedLock lock(uniqueIdMutex);
|
FastMutex::ScopedLock lock(getUniqueIdMutex());
|
||||||
|
|
||||||
static unsigned count = 0;
|
static unsigned count = 0;
|
||||||
++count;
|
++count;
|
||||||
|
|||||||
Reference in New Issue
Block a user