diff --git a/Foundation/src/Thread.cpp b/Foundation/src/Thread.cpp index 6e320e5c5..2b55fed79 100644 --- a/Foundation/src/Thread.cpp +++ b/Foundation/src/Thread.cpp @@ -18,6 +18,7 @@ #include "Poco/Mutex.h" #include "Poco/Exception.h" #include "Poco/ThreadLocal.h" +#include "Poco/AtomicCounter.h" #include @@ -144,23 +145,10 @@ std::string Thread::makeName() } -namespace -{ - FastMutex& getUniqueIdMutex() - { - static FastMutex uniqueIdMutex; - return uniqueIdMutex; - } -} - - int Thread::uniqueId() { - FastMutex::ScopedLock lock(getUniqueIdMutex()); - - static unsigned count = 0; - ++count; - return count; + static Poco::AtomicCounter counter; + return ++counter; }