mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-23 07:12:45 +01: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
|
||||
{
|
||||
static FastMutex uniqueIdMutex;
|
||||
FastMutex& getUniqueIdMutex()
|
||||
{
|
||||
static FastMutex uniqueIdMutex;
|
||||
return uniqueIdMutex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int Thread::uniqueId()
|
||||
{
|
||||
FastMutex::ScopedLock lock(uniqueIdMutex);
|
||||
FastMutex::ScopedLock lock(getUniqueIdMutex());
|
||||
|
||||
static unsigned count = 0;
|
||||
++count;
|
||||
|
Loading…
x
Reference in New Issue
Block a user