mirror of
https://github.com/pocoproject/poco.git
synced 2025-07-01 16:33:28 +02:00
GH #282: Using Thread in a global can cause crash on Windows
This commit is contained in:
parent
ba0d9830eb
commit
b5ce0804a1
@ -146,13 +146,17 @@ 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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user