Changeset 14599 for trunk/FACT++
- Timestamp:
- 11/10/12 13:03:32 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/InterpreterV8.cc
r14598 r14599 34 34 fThreadIds.clear(); 35 35 36 if (fThreadId>=0) 37 V8::TerminateExecution(fThreadId); 36 if (fThreadId<0) 37 return; 38 39 V8::TerminateExecution(fThreadId); 40 fThreadId = -1; 38 41 } 39 42 … … 51 54 // of four using a larger value, but this also means that the 52 55 // JavaScript is locked for a longer time. 56 const Unlocker unlock; 53 57 usleep(1000); 54 58 return Undefined(); … … 77 81 78 82 return handle_scope.Close(script->Run()); 79 80 //JsSleep(args[0]->Int32Value());81 //return Undefined();82 83 } 83 84 84 85 void InterpreterV8::ThreadTimeout(Persistent<Function> func, uint32_t ms) 85 86 { 87 const Locker lock; 88 86 89 if (fThreadId<0) 87 90 return; 88 91 89 Locker lock;90 91 const HandleScope handle_scope;92 93 fGlobalContext->Enter();94 95 92 const int id = V8::GetCurrentThreadId(); 96 93 fThreadIds.insert(id); 94 95 const HandleScope handle_scope; 96 97 fGlobalContext->Enter(); 97 98 98 99 TryCatch exception; … … 891 892 void InterpreterV8::JsHandleEvent(const EventImp &evt, uint64_t cnt, const string &service) 892 893 { 894 const Locker locker; 895 893 896 if (fThreadId<0) 894 897 return; 895 896 Locker locker;897 898 898 899 const auto it = fReverseMap.find(service); … … 966 967 void InterpreterV8::JsHandleState(const std::string &server, const State &state) 967 968 { 969 const Locker locker; 970 968 971 if (fThreadId<0) 969 972 return; 970 971 Locker locker;972 973 973 974 auto it = fStateCallbacks.find(server); … … 1482 1483 bool InterpreterV8::JsRun(const string &filename, const map<string, string> &map) 1483 1484 { 1484 Locker locker;1485 const Locker locker; 1485 1486 fThreadId = V8::GetCurrentThreadId(); 1486 1487 … … 1571 1572 // the signal to terminate. After they are all successfully 1572 1573 // terminated, just to be sure... we lock again 1573 Unlocker unlock;1574 1575 for (auto it=fTimeout.begin(); it!=fTimeout.end(); it++) 1576 it->join();1577 fTimeout.clear();1578 1579 Locker lock2;1574 { 1575 const Unlocker unlock; 1576 1577 for (auto it=fTimeout.begin(); it!=fTimeout.end(); it++) 1578 it->join(); 1579 fTimeout.clear(); 1580 } 1580 1581 1581 1582 // Now we can dispose all persistent handles from state callbacks
Note:
See TracChangeset
for help on using the changeset viewer.