summaryrefslogtreecommitdiffstats
path: root/src/uscxml/Interpreter.cpp
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-18 09:54:40 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-18 09:54:40 (GMT)
commit228c809a34fc270527c39522c7a361004197a786 (patch)
tree9025ff36c6c73a3b994e48bd30f240dcf2f794d7 /src/uscxml/Interpreter.cpp
parent7c76e603c874009346208c61ad7a3386997b58d1 (diff)
downloaduscxml-228c809a34fc270527c39522c7a361004197a786.zip
uscxml-228c809a34fc270527c39522c7a361004197a786.tar.gz
uscxml-228c809a34fc270527c39522c7a361004197a786.tar.bz2
Protect parts of interpreter with mutexes
Diffstat (limited to 'src/uscxml/Interpreter.cpp')
-rw-r--r--src/uscxml/Interpreter.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index c951999..87eae11 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -232,19 +232,18 @@ bool InterpreterImpl::runOnMainThread(int fps, bool blocking) {
_lastRunOnMainThread = tthread::timeStamp();
{
- tthread::lock_guard<tthread::recursive_mutex> lock(_ioProcMutex);
+ tthread::lock_guard<tthread::recursive_mutex> lock(_pluginMutex);
std::map<std::string, IOProcessor>::iterator ioProcessorIter = _ioProcessors.begin();
while(ioProcessorIter != _ioProcessors.end()) {
ioProcessorIter->second.runOnMainThread();
ioProcessorIter++;
}
+ std::map<std::string, Invoker>::iterator invokerIter = _invokers.begin();
+ while(invokerIter != _invokers.end()) {
+ invokerIter->second.runOnMainThread();
+ invokerIter++;
+ }
}
- std::map<std::string, Invoker>::iterator invokerIter = _invokers.begin();
- while(invokerIter != _invokers.end()) {
- invokerIter->second.runOnMainThread();
- invokerIter++;
- }
-
return (_thread != NULL);
}
@@ -826,7 +825,7 @@ void InterpreterImpl::invoke(const Arabica::DOM::Node<std::string>& element) {
Invoker invoker(Factory::createInvoker(invokeReq.type, this));
if (invoker) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ tthread::lock_guard<tthread::recursive_mutex> lock(_pluginMutex);
try {
invoker.setInvokeId(invokeReq.invokeid);
invoker.setType(invokeReq.type);
@@ -1620,7 +1619,7 @@ bool InterpreterImpl::isCompound(const Arabica::DOM::Node<std::string>& state) {
}
void InterpreterImpl::setupIOProcessors() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_ioProcMutex);
+ tthread::lock_guard<tthread::recursive_mutex> lock(_pluginMutex);
std::map<std::string, IOProcessorImpl*>::iterator ioProcIter = Factory::getInstance()->_ioProcessors.begin();
while(ioProcIter != Factory::getInstance()->_ioProcessors.end()) {
if (boost::iequals(ioProcIter->first, "basichttp") && !(_capabilities & CAN_BASIC_HTTP)) {
@@ -1665,7 +1664,7 @@ void InterpreterImpl::setupIOProcessors() {
}
IOProcessor InterpreterImpl::getIOProcessor(const std::string& type) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_ioProcMutex);
+ tthread::lock_guard<tthread::recursive_mutex> lock(_pluginMutex);
if (_ioProcessors.find(type) == _ioProcessors.end()) {
LOG(ERROR) << "No ioProcessor known for type " << type;
return IOProcessor();