diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-17 23:06:26 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-17 23:06:26 (GMT) |
commit | 7c76e603c874009346208c61ad7a3386997b58d1 (patch) | |
tree | 2ecf830f7e343af4d8f0439f43ae0cbdafd7b3ba | |
parent | eba3e69a20da96e527827ac83a537cde8bdc66ba (diff) | |
download | uscxml-7c76e603c874009346208c61ad7a3386997b58d1.zip uscxml-7c76e603c874009346208c61ad7a3386997b58d1.tar.gz uscxml-7c76e603c874009346208c61ad7a3386997b58d1.tar.bz2 |
Revert "Protect parts of interpreter with mutexes for thread-safety"
This reverts commit eba3e69a20da96e527827ac83a537cde8bdc66ba.
-rw-r--r-- | src/uscxml/Interpreter.cpp | 1 | ||||
-rw-r--r-- | src/uscxml/Interpreter.h | 2 | ||||
-rw-r--r-- | src/uscxml/interpreter/InterpreterDraft6.cpp | 18 |
3 files changed, 2 insertions, 19 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index b2e61fd..c951999 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -190,6 +190,7 @@ void InterpreterImpl::setName(const std::string& name) { } InterpreterImpl::~InterpreterImpl() { + tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); if (_thread) { _running = false; // unblock event queue diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h index 1075a1c..f28eb69 100644 --- a/src/uscxml/Interpreter.h +++ b/src/uscxml/Interpreter.h @@ -142,12 +142,10 @@ public: void receive(const Event& event, bool toFront = false); Event getCurrentEvent() { - tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); return _currEvent; } Arabica::XPath::NodeSet<std::string> getConfiguration() { - tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); return _configuration; } void setConfiguration(const std::vector<std::string>& states) { diff --git a/src/uscxml/interpreter/InterpreterDraft6.cpp b/src/uscxml/interpreter/InterpreterDraft6.cpp index f73051e..a15e9a4 100644 --- a/src/uscxml/interpreter/InterpreterDraft6.cpp +++ b/src/uscxml/interpreter/InterpreterDraft6.cpp @@ -101,6 +101,7 @@ void InterpreterDraft6::interpret() { assert(initialTransitions.size() > 0); enterStates(initialTransitions); + _mutex.unlock(); // assert(hasLegalConfiguration()); mainEventLoop(); @@ -136,7 +137,6 @@ void InterpreterDraft6::mainEventLoop() { } std::cout << std::endl; #endif - _mutex.unlock(); monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { @@ -148,7 +148,6 @@ void InterpreterDraft6::mainEventLoop() { } monIter++; } - _mutex.lock(); enabledTransitions = selectEventlessTransitions(); if (enabledTransitions.size() == 0) { @@ -166,7 +165,6 @@ void InterpreterDraft6::mainEventLoop() { } } if (!enabledTransitions.empty()) { - _mutex.unlock(); monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { @@ -178,8 +176,6 @@ void InterpreterDraft6::mainEventLoop() { } monIter++; } - _mutex.lock(); - // test 403b enabledTransitions.to_document_order(); microstep(enabledTransitions); @@ -200,8 +196,6 @@ void InterpreterDraft6::mainEventLoop() { // assume that we have a legal configuration as soon as the internal queue is empty assert(hasLegalConfiguration()); - _mutex.unlock(); - monIter = _monitors.begin(); // if (!_sendQueue || _sendQueue->isEmpty()) { while(monIter != _monitors.end()) { @@ -229,8 +223,6 @@ void InterpreterDraft6::mainEventLoop() { if (!_running) goto EXIT_INTERPRETER; - _mutex.lock(); - if (_dataModel && boost::iequals(_currEvent.name, "cancel.invoke." + _sessionId)) break; @@ -652,7 +644,6 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e std::cout << std::endl; #endif - _mutex.unlock(); monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { @@ -664,7 +655,6 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e } monIter++; } - _mutex.lock(); for (int i = 0; i < statesToExit.size(); i++) { NodeSet<std::string> histories = filterChildElements(_xmlNSPrefix + "history", statesToExit[i]); @@ -715,7 +705,6 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e _configuration.insert(_configuration.end(), tmp.begin(), tmp.end()); } - _mutex.unlock(); monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { @@ -727,7 +716,6 @@ void InterpreterDraft6::exitStates(const Arabica::XPath::NodeSet<std::string>& e } monIter++; } - _mutex.lock(); } @@ -834,7 +822,6 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& } statesToEnter.to_document_order(); - _mutex.unlock(); monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { @@ -846,7 +833,6 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& } monIter++; } - _mutex.lock(); for (int i = 0; i < statesToEnter.size(); i++) { Element<std::string> stateElem = (Element<std::string>)statesToEnter[i]; @@ -904,7 +890,6 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& } } - _mutex.unlock(); monIter = _monitors.begin(); while(monIter != _monitors.end()) { try { @@ -916,7 +901,6 @@ void InterpreterDraft6::enterStates(const Arabica::XPath::NodeSet<std::string>& } monIter++; } - _mutex.lock(); } |