atomicallyInitializedStaticMutex->unlock();
}
-static ThreadIdentifier mainThreadIdentifier;
-
static Mutex& threadMapMutex()
{
static Mutex mutex;
void initializeThreading()
{
- if (!atomicallyInitializedStaticMutex) {
- atomicallyInitializedStaticMutex = new Mutex;
- threadMapMutex();
- initializeRandomNumberGenerator();
- initializeMainThread();
- mainThreadIdentifier = currentThread();
- initializeCurrentThreadInternal("Main Thread");
- }
+ if (atomicallyInitializedStaticMutex)
+ return;
+
+ atomicallyInitializedStaticMutex = new Mutex;
+ threadMapMutex();
+ initializeRandomNumberGenerator();
}
static HashMap<DWORD, HANDLE>& threadMap()
return static_cast<ThreadIdentifier>(GetCurrentThreadId());
}
-bool isMainThread()
-{
- return currentThread() == mainThreadIdentifier;
-}
-
Mutex::Mutex()
{
m_mutex.m_recursionCount = 0;