diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-03-26 22:20:03 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-03-26 22:20:03 (GMT) |
commit | 83f0b4ecbd83e83b5404afd5cead7a08966495bf (patch) | |
tree | ff887fca701fe27221a04bf2c304e3ecb4cbf7cc /src/uscxml | |
parent | 405c805f249cacb07f8861d5550abda8f6694d0c (diff) | |
download | uscxml-83f0b4ecbd83e83b5404afd5cead7a08966495bf.zip uscxml-83f0b4ecbd83e83b5404afd5cead7a08966495bf.tar.gz uscxml-83f0b4ecbd83e83b5404afd5cead7a08966495bf.tar.bz2 |
Implemented ParentQueues for PHP
Diffstat (limited to 'src/uscxml')
-rw-r--r-- | src/uscxml/Interpreter.cpp | 3 | ||||
-rw-r--r-- | src/uscxml/Interpreter.h | 5 | ||||
-rw-r--r-- | src/uscxml/concurrency/BlockingQueue.h | 2 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index ef30033..16b3209 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -38,7 +38,7 @@ Interpreter::Interpreter() : Arabica::SAX2DOM::Parser<std::string>() { _sendQueue = NULL; _parentQueue = NULL; _running = false; - _done = false; + _done = true; _isInitialized = false; _httpServlet = NULL; _capabilities = CAN_BASIC_HTTP | CAN_GENERIC_HTTP; @@ -884,6 +884,7 @@ void Interpreter::delayedSend(void* userdata, std::string eventName) { if (boost::iequals(sendReq.target, "#_parent")) { // send to parent scxml session if (INSTANCE->_parentQueue != NULL) { +// LOG(ERROR) << "Pushing into parent queue: " << INSTANCE->_parentQueue << std::endl; INSTANCE->_parentQueue->push(sendReq); } else { LOG(ERROR) << "Can not send to parent, we were not invoked" << std::endl; diff --git a/src/uscxml/Interpreter.h b/src/uscxml/Interpreter.h index d60a7e4..d75241e 100644 --- a/src/uscxml/Interpreter.h +++ b/src/uscxml/Interpreter.h @@ -98,6 +98,9 @@ public: void join() { if (_thread != NULL) _thread->join(); }; + bool isRunning() { + return _running || !_done; + } void interpret(); @@ -199,7 +202,7 @@ public: static bool isParallel(const Arabica::DOM::Node<std::string>& state); static bool isCompound(const Arabica::DOM::Node<std::string>& state); static bool isDescendant(const Arabica::DOM::Node<std::string>& s1, const Arabica::DOM::Node<std::string>& s2); - + bool isInitial(const Arabica::DOM::Node<std::string>& state); Arabica::DOM::Node<std::string> getInitialState(Arabica::DOM::Node<std::string> state = Arabica::DOM::Node<std::string>()); static Arabica::XPath::NodeSet<std::string> getChildStates(const Arabica::DOM::Node<std::string>& state); diff --git a/src/uscxml/concurrency/BlockingQueue.h b/src/uscxml/concurrency/BlockingQueue.h index 0f4c965..0826590 100644 --- a/src/uscxml/concurrency/BlockingQueue.h +++ b/src/uscxml/concurrency/BlockingQueue.h @@ -28,6 +28,7 @@ public: virtual T pop() { tthread::lock_guard<tthread::mutex> lock(_mutex); +// std::cout << "Popping from " << this << std::endl; while (_queue.empty()) { _cond.wait(_mutex); } @@ -41,6 +42,7 @@ public: return _queue.empty(); } +protected: tthread::mutex _mutex; tthread::condition_variable _cond; std::list<T> _queue; |