Changeset 11284 in webkit for trunk/JavaScriptCore/kjs/internal.cpp
- Timestamp:
- Nov 22, 2005, 9:41:23 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/internal.cpp
r11213 r11284 74 74 75 75 #endif // APPLE_CHANGES 76 77 #if defined(KJS_MULTIPLE_THREADS) && KJS_MULTIPLE_THREADS78 79 static pthread_once_t interpreterLockOnce = PTHREAD_ONCE_INIT;80 static pthread_mutex_t interpreterLock;81 static int interpreterLockCount = 0;82 83 static void initializeInterpreterLock()84 {85 pthread_mutexattr_t attr;86 87 pthread_mutexattr_init(&attr);88 pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);89 90 pthread_mutex_init(&interpreterLock, &attr);91 }92 93 static inline void lockInterpreter()94 {95 pthread_once(&interpreterLockOnce, initializeInterpreterLock);96 pthread_mutex_lock(&interpreterLock);97 interpreterLockCount++;98 Collector::registerThread();99 }100 101 static inline void unlockInterpreter()102 {103 interpreterLockCount--;104 pthread_mutex_unlock(&interpreterLock);105 }106 107 #else108 109 static inline void initializeInterpreterLock() { }110 static inline void lockInterpreter() { }111 static inline void unlockInterpreter() { }112 113 const int interpreterLockCount = 1;114 115 #endif116 76 117 77 // ------------------------------ UndefinedImp --------------------------------- … … 472 432 473 433 recursion = 0; 474 }475 476 void InterpreterImp::lock()477 {478 lockInterpreter();479 480 // FIXME: Hack-o-rama. To prevent construction of a global object with a null prototype (4342216),481 // we need to intialize our constants before the first object is constructed. InterpreterImp::lock()482 // is a good place to do this because you have to call it before doing any allocations. Once we change our483 // implementation to use immediate values, we should remove this code.484 ConstantValues::initIfNeeded();485 }486 487 int InterpreterImp::lockCount()488 {489 return interpreterLockCount;490 }491 492 void InterpreterImp::unlock()493 {494 unlockInterpreter();495 434 } 496 435
Note:
See TracChangeset
for help on using the changeset viewer.