Ignore:
Timestamp:
Apr 13, 2003, 12:31:44 AM (22 years ago)
Author:
mjs
Message:

Reviewed by Don.

  • JavaScriptCore part of fix for 3158769 - JavaScript triggers not as async as they used to be

Added a way to get the current interpreter lock count, so Sherlock
can unlock the interpreter inside JS method implementations that
spend a long time waiting for I/O, allowing more efficient
multi-threaded operation.

  • kjs/internal.cpp: (lockInterpreter): (unlockInterpreter): (InterpreterImp::lock): (InterpreterImp::lockCount):
  • kjs/internal.h:
  • kjs/interpreter.cpp: (Interpreter::lockCount):
  • kjs/interpreter.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/internal.cpp

    r3745 r4087  
    7373static pthread_once_t interpreterLockOnce = PTHREAD_ONCE_INIT;
    7474static pthread_mutex_t interpreterLock;
     75static int interpreterLockCount = 0;
    7576
    7677static void initializeInterpreterLock()
     
    8889  pthread_once(&interpreterLockOnce, initializeInterpreterLock);
    8990  pthread_mutex_lock(&interpreterLock);
     91  interpreterLockCount++;
    9092}
    9193
    9294static inline void unlockInterpreter()
    9395{
     96  interpreterLockCount--;
    9497  pthread_mutex_unlock(&interpreterLock);
    9598}
     
    531534{
    532535  lockInterpreter();
     536}
     537
     538int InterpreterImp::lockCount()
     539{
     540  return interpreterLockCount;
    533541}
    534542
Note: See TracChangeset for help on using the changeset viewer.