Changeset 31560 in webkit for trunk/JavaScriptCore
- Timestamp:
- Apr 1, 2008, 11:38:32 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r31454 r31560 1 2008-04-01 Alexey Proskuryakov <[email protected]> 2 3 Reviewed by Darin. 4 5 Make MathExtras.h thread safe. 6 7 * kjs/math_object.cpp: 8 (KJS::mathProtoFuncRandom): If threading is enabled, rely on initializeThreading to call 9 wtf_random_init(). 10 11 * wtf/Threading.h: 12 * wtf/ThreadingGtk.cpp: 13 (WTF::initializeThreading): 14 * wtf/ThreadingNone.cpp: 15 (WTF::initializeThreading): 16 * wtf/ThreadingPthreads.cpp: 17 (WTF::initializeThreading): 18 * wtf/ThreadingWin.cpp: 19 (WTF::initializeThreading): 20 Call wtf_random_init(); made the function non-inline to avoid having to include too many 21 headers in Threading.h. 22 1 23 2008-03-31 Eric Seidel <[email protected]> 2 24 -
trunk/JavaScriptCore/kjs/math_object.cpp
r29541 r31560 207 207 } 208 208 209 static bool didInitRandom;210 211 209 JSValue* mathProtoFuncRandom(ExecState*, JSObject*, const List&) 212 210 { 211 #if !USE(MULTIPLE_THREADS) 212 static bool didInitRandom; 213 213 if (!didInitRandom) { 214 214 wtf_random_init(); 215 215 didInitRandom = true; 216 216 } 217 #endif 218 217 219 return jsNumber(wtf_random()); 218 220 } -
trunk/JavaScriptCore/wtf/Threading.h
r31404 r31560 243 243 extern Mutex* atomicallyInitializedStaticMutex; 244 244 245 #if !PLATFORM(GTK)246 inline void initializeThreading()247 {248 if (!atomicallyInitializedStaticMutex)249 atomicallyInitializedStaticMutex = new Mutex;250 }251 #endif252 253 245 } // namespace WTF 254 246 -
trunk/JavaScriptCore/wtf/ThreadingGtk.cpp
r30851 r31560 31 31 #include "Threading.h" 32 32 33 #include "HashMap.h" 33 #include <wtf/HashMap.h> 34 #include <wtf/MathExtras.h> 34 35 35 36 #include <glib.h> … … 45 46 ASSERT(!atomicallyInitializedStaticMutex); 46 47 atomicallyInitializedStaticMutex = new Mutex; 48 wtf_random_init(); 47 49 } 48 50 ASSERT(g_thread_supported()); -
trunk/JavaScriptCore/wtf/ThreadingNone.cpp
r30849 r31560 34 34 Mutex* atomicallyInitializedStaticMutex; 35 35 36 void initializeThreading() {} 36 37 ThreadIdentifier createThread(ThreadFunction, void*) { return 0; } 37 38 int waitForThreadCompletion(ThreadIdentifier, void**) { return 0; } -
trunk/JavaScriptCore/wtf/ThreadingPthreads.cpp
r31048 r31560 31 31 32 32 #include <wtf/HashMap.h> 33 #include <wtf/MathExtras.h> 33 34 34 35 #include <errno.h> … … 38 39 39 40 Mutex* atomicallyInitializedStaticMutex; 41 42 void initializeThreading() 43 { 44 if (!atomicallyInitializedStaticMutex) { 45 atomicallyInitializedStaticMutex = new Mutex; 46 wtf_random_init(); 47 } 48 } 40 49 41 50 static Mutex& threadMapMutex() -
trunk/JavaScriptCore/wtf/ThreadingWin.cpp
r30855 r31560 66 66 #include <windows.h> 67 67 #include <wtf/HashMap.h> 68 #include <wtf/MathExtras.h> 68 69 69 70 namespace WTF { 70 71 71 72 Mutex* atomicallyInitializedStaticMutex; 73 74 void initializeThreading() 75 { 76 if (!atomicallyInitializedStaticMutex) { 77 atomicallyInitializedStaticMutex = new Mutex; 78 wtf_random_init(); 79 } 80 } 72 81 73 82 static Mutex& threadMapMutex()
Note:
See TracChangeset
for help on using the changeset viewer.