summaryrefslogtreecommitdiffstats
path: root/src/engine/MessageContext.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-11-22 16:13:01 +0000
committerDavid Robillard <d@drobilla.net>2009-11-22 16:13:01 +0000
commit306ea241f0f1db66215bc177a1e8ec8ec341f509 (patch)
tree3340f05ae96cd3d98fd191bd0905d43e62a9b70d /src/engine/MessageContext.cpp
parent1745a63b874c296253a27ca7ad95d3a7b17822f7 (diff)
downloadingen-306ea241f0f1db66215bc177a1e8ec8ec341f509.tar.gz
ingen-306ea241f0f1db66215bc177a1e8ec8ec341f509.tar.bz2
ingen-306ea241f0f1db66215bc177a1e8ec8ec341f509.zip
Enqueue message thread requests by the port, not by the node.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2283 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/MessageContext.cpp')
-rw-r--r--src/engine/MessageContext.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/engine/MessageContext.cpp b/src/engine/MessageContext.cpp
index 6e08eb8d..1ffc4bfc 100644
--- a/src/engine/MessageContext.cpp
+++ b/src/engine/MessageContext.cpp
@@ -23,6 +23,7 @@
#include "NodeImpl.hpp"
#include "PatchImpl.hpp"
#include "PortImpl.hpp"
+#include "PortImpl.hpp"
#include "ProcessContext.hpp"
#include "ThreadManager.hpp"
@@ -32,20 +33,20 @@ namespace Ingen {
void
-MessageContext::run(NodeImpl* node, FrameTime time)
+MessageContext::run(PortImpl* port, FrameTime time)
{
if (ThreadManager::current_thread_id() == THREAD_PRE_PROCESS) {
- assert(node);
+ assert(port);
Glib::Mutex::Lock lock(_mutex);
- _non_rt_request = Request(time, node);
+ _non_rt_request = Request(time, port);
_sem.post();
_cond.wait(_mutex);
} else if (ThreadManager::current_thread_id() == THREAD_PROCESS) {
- Request r(time, node);
+ Request r(time, port);
_requests.write(sizeof(Request), &r);
// signal() will be called at the end of this process cycle
} else if (ThreadManager::current_thread_id() == THREAD_MESSAGE) {
- cout << "Message context recursion at " << node->path() << endl;
+ cout << "Message context recursion at " << port->path() << endl;
} else {
cout << "[MessageContext] ERROR: Run requested from unknown thread" << endl;
}
@@ -64,7 +65,7 @@ MessageContext::_run()
{
Glib::Mutex::Lock lock(_mutex);
const Request req = _non_rt_request;
- if (req.node) {
+ if (req.port) {
_queue.insert(req);
_end_time = std::max(_end_time, req.time);
_cond.broadcast(); // Notify caller we got the message
@@ -74,7 +75,7 @@ MessageContext::_run()
// Enqueue (and thereby sort) requests from audio thread
while (has_requests()) {
_requests.full_read(sizeof(Request), &req);
- if (req.node) {
+ if (req.port) {
_queue.insert(req);
} else {
_end_time = req.time;
@@ -103,7 +104,7 @@ MessageContext::_run()
void
MessageContext::execute(const Request& req)
{
- NodeImpl* node = req.node;
+ NodeImpl* node = req.port->parent_node();
node->message_run(*this);
void* valid_ports = node->valid_ports();
@@ -116,8 +117,8 @@ MessageContext::execute(const Request& req)
PatchImpl::Connections& wires = patch->connections();
for (PatchImpl::Connections::iterator c = wires.begin(); c != wires.end(); ++c) {
ConnectionImpl* ci = dynamic_cast<ConnectionImpl*>(c->get());
- if (ci->src_port() == p) {
- _queue.insert(Request(req.time, ci->dst_port()->parent_node()));
+ if (ci->src_port() == p && ci->dst_port()->context() == Context::MESSAGE) {
+ _queue.insert(Request(req.time, ci->dst_port()));
}
}
}