summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-07 10:40:56 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-04-07 10:40:56 (GMT)
commit46d089f8642501cf2ffc4a531add0a3a8eaa268e (patch)
tree7d1d3d59dbc745224a883807236effbbb4ecb176 /src
parent1e6ba139ac12c688f025745812d381915775b1fb (diff)
downloaduscxml-46d089f8642501cf2ffc4a531add0a3a8eaa268e.zip
uscxml-46d089f8642501cf2ffc4a531add0a3a8eaa268e.tar.gz
uscxml-46d089f8642501cf2ffc4a531add0a3a8eaa268e.tar.bz2
Some more bugfixes for revised W3C tests
Diffstat (limited to 'src')
-rw-r--r--src/uscxml/Interpreter.cpp18
-rw-r--r--src/uscxml/Interpreter.h1
-rw-r--r--src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp4
3 files changed, 13 insertions, 10 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp
index 48410a9..ee1a3b9 100644
--- a/src/uscxml/Interpreter.cpp
+++ b/src/uscxml/Interpreter.cpp
@@ -23,6 +23,7 @@
#define VERBOSE 0
+/// macro to catch exceptions in executeContent
#define CATCH_AND_DISTRIBUTE(msg) \
catch (Event e) {\
LOG(ERROR) << msg << std::endl << e << std::endl;\
@@ -259,13 +260,14 @@ bool InterpreterImpl::runOnMainThread(int fps, bool blocking) {
_lastRunOnMainThread = tthread::timeStamp();
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
- std::map<std::string, IOProcessor>::iterator ioProcessorIter = _ioProcessors.begin();
- while(ioProcessorIter != _ioProcessors.end()) {
- ioProcessorIter->second.runOnMainThread();
- ioProcessorIter++;
+ {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_ioProcMutex);
+ 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();
@@ -1664,7 +1666,7 @@ bool InterpreterImpl::isCompound(const Arabica::DOM::Node<std::string>& state) {
}
void InterpreterImpl::setupIOProcessors() {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ tthread::lock_guard<tthread::recursive_mutex> lock(_ioProcMutex);
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)) {
@@ -1709,7 +1711,7 @@ void InterpreterImpl::setupIOProcessors() {
}
IOProcessor InterpreterImpl::getIOProcessor(const std::string& type) {
- tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ tthread::lock_guard<tthread::recursive_mutex> lock(_ioProcMutex);
if (_ioProcessors.find(type) == _ioProcessors.end()) {
LOG(ERROR) << "No ioProcessor known for type " << type;
return IOProcessor();
diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h
index 6701eff..9be85ff 100644
--- a/src/uscxml/Interpreter.h
+++ b/src/uscxml/Interpreter.h
@@ -234,6 +234,7 @@ protected:
bool _stable;
tthread::thread* _thread;
tthread::recursive_mutex _mutex;
+ tthread::recursive_mutex _ioProcMutex;
URL _baseURI;
Arabica::DOM::Document<std::string> _document;
diff --git a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp
index 387075b..3dabafe 100644
--- a/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/scxml/SCXMLIOProcessor.cpp
@@ -82,7 +82,7 @@ void SCXMLIOProcessor::send(const SendRequest& req) {
*/
_interpreter->receiveInternal(reqCopy);
- } else if(reqCopy.target.find_first_of("#_scxml_") == 0) {
+ } else if(boost::starts_with(reqCopy.target, "#_scxml_")) {
/**
* #_scxml_sessionid: If the target is the special term '#_scxml_sessionid',
* where sessionid is the id of an SCXML session that is accessible to the
@@ -113,7 +113,7 @@ void SCXMLIOProcessor::send(const SendRequest& req) {
LOG(ERROR) << "Can not send to parent, we were not invoked" << std::endl;
_interpreter->receiveInternal(Event("error.communication", Event::PLATFORM));
}
- } else if (reqCopy.target.find_first_of("#_") == 0) {
+ } else if (boost::starts_with(reqCopy.target, "#_") == 0) {
/**
* #_invokeid: If the target is the special term '#_invokeid', where invokeid
* is the invokeid of an SCXML session that the sending session has created