Changeset 31690 in webkit for trunk/JavaScriptCore
- Timestamp:
- Apr 7, 2008, 2:04:38 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r31677 r31690 1 2008-04-07 Adam Roben <[email protected]> 2 3 Add WTF::isMainThread 4 5 Reviewed by Alexey Proskuryakov. 6 7 * wtf/Threading.h: Declare the new function. 8 * wtf/ThreadingGtk.cpp: 9 (WTF::initializeThreading): Initialize the main thread identifier. 10 (WTF::isMainThread): Added. 11 * wtf/ThreadingNone.cpp: Ditto ThreadingGtk.cpp. 12 (WTF::initializeThreading): 13 (WTF::isMainThread): 14 * wtf/ThreadingPthreads.cpp: Ditto. 15 (WTF::initializeThreading): 16 (WTF::isMainThread): 17 * wtf/ThreadingWin.cpp: Ditto. 18 (WTF::initializeThreading): 19 (WTF::isMainThread): 20 1 21 2008-04-06 Alexey Proskuryakov <[email protected]> 2 22 -
trunk/JavaScriptCore/wtf/Threading.h
r31560 r31690 106 106 ThreadIdentifier createThread(ThreadFunction, void*); 107 107 ThreadIdentifier currentThread(); 108 bool isMainThread(); 108 109 int waitForThreadCompletion(ThreadIdentifier, void**); 109 110 void detachThread(ThreadIdentifier); … … 253 254 using WTF::createThread; 254 255 using WTF::currentThread; 256 using WTF::isMainThread; 255 257 using WTF::detachThread; 256 258 using WTF::waitForThreadCompletion; -
trunk/JavaScriptCore/wtf/ThreadingGtk.cpp
r31560 r31690 40 40 Mutex* atomicallyInitializedStaticMutex; 41 41 42 static ThreadIdentifier mainThreadIdentifier; 43 42 44 void initializeThreading() 43 45 { … … 47 49 atomicallyInitializedStaticMutex = new Mutex; 48 50 wtf_random_init(); 51 mainThreadIdentifier = currentThread(); 49 52 } 50 53 ASSERT(g_thread_supported()); … … 137 140 return id; 138 141 return establishIdentifierForThread(currentThread); 142 } 143 144 bool isMainThread() 145 { 146 return currentThread() == mainThreadIdentifier; 139 147 } 140 148 -
trunk/JavaScriptCore/wtf/ThreadingNone.cpp
r31560 r31690 39 39 void detachThread(ThreadIdentifier) { } 40 40 ThreadIdentifier currentThread() { return 0; } 41 bool isMainThread() { return false; } 41 42 42 43 Mutex::Mutex() {} -
trunk/JavaScriptCore/wtf/ThreadingPthreads.cpp
r31560 r31690 40 40 Mutex* atomicallyInitializedStaticMutex; 41 41 42 static ThreadIdentifier mainThreadIdentifier; 43 42 44 void initializeThreading() 43 45 { … … 45 47 atomicallyInitializedStaticMutex = new Mutex; 46 48 wtf_random_init(); 49 mainThreadIdentifier = currentThread(); 47 50 } 48 51 } … … 145 148 } 146 149 150 bool isMainThread() 151 { 152 return currentThread() == mainThreadIdentifier; 153 } 154 147 155 Mutex::Mutex() 148 156 { -
trunk/JavaScriptCore/wtf/ThreadingWin.cpp
r31560 r31690 64 64 #include "Threading.h" 65 65 66 #include "MainThread.h" 66 67 #include <windows.h> 67 68 #include <wtf/HashMap.h> … … 72 73 Mutex* atomicallyInitializedStaticMutex; 73 74 75 static ThreadIdentifier mainThreadIdentifier; 76 74 77 void initializeThreading() 75 78 { … … 77 80 atomicallyInitializedStaticMutex = new Mutex; 78 81 wtf_random_init(); 82 initializeMainThread(); 83 mainThreadIdentifier = currentThread(); 79 84 } 80 85 } … … 159 164 { 160 165 return static_cast<ThreadIdentifier>(::GetCurrentThreadId()); 166 } 167 168 bool isMainThread() 169 { 170 return currentThread() == mainThreadIdentifier; 161 171 } 162 172
Note:
See TracChangeset
for help on using the changeset viewer.