diff options
Diffstat (limited to 'JavaScriptCore/wtf/ThreadingWin.cpp')
| -rw-r--r-- | JavaScriptCore/wtf/ThreadingWin.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/JavaScriptCore/wtf/ThreadingWin.cpp b/JavaScriptCore/wtf/ThreadingWin.cpp index 73c3f0c..a29fbbb 100644 --- a/JavaScriptCore/wtf/ThreadingWin.cpp +++ b/JavaScriptCore/wtf/ThreadingWin.cpp @@ -145,8 +145,6 @@ void unlockAtomicallyInitializedStaticMutex() atomicallyInitializedStaticMutex->unlock(); } -static ThreadIdentifier mainThreadIdentifier; - static Mutex& threadMapMutex() { static Mutex mutex; @@ -155,14 +153,12 @@ static Mutex& threadMapMutex() 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() @@ -270,14 +266,14 @@ void detachThread(ThreadIdentifier threadID) clearThreadHandleForIdentifier(threadID); } -ThreadIdentifier currentThread() +void yield() { - return static_cast<ThreadIdentifier>(GetCurrentThreadId()); + ::Sleep(1); } -bool isMainThread() +ThreadIdentifier currentThread() { - return currentThread() == mainThreadIdentifier; + return static_cast<ThreadIdentifier>(GetCurrentThreadId()); } Mutex::Mutex() |
