summaryrefslogtreecommitdiffstats
path: root/src/server/RunContext.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-12-06 11:03:35 -0500
committerDavid Robillard <d@drobilla.net>2016-12-13 19:15:26 -0500
commit0752556bde5659a933744658cdf63509000a5080 (patch)
tree0ab580ab247f55886515ad23e1bd89a51063acd9 /src/server/RunContext.cpp
parent6502a2505fc390e3099331b5ea521efd56812aaa (diff)
downloadingen-0752556bde5659a933744658cdf63509000a5080.tar.gz
ingen-0752556bde5659a933744658cdf63509000a5080.tar.bz2
ingen-0752556bde5659a933744658cdf63509000a5080.zip
Fix some real-time safety issues
Diffstat (limited to 'src/server/RunContext.cpp')
-rw-r--r--src/server/RunContext.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/server/RunContext.cpp b/src/server/RunContext.cpp
index e107d247..1ab73605 100644
--- a/src/server/RunContext.cpp
+++ b/src/server/RunContext.cpp
@@ -46,10 +46,12 @@ struct Notification
LV2_URID type;
};
-RunContext::RunContext(Engine& engine, unsigned id, bool threaded)
+RunContext::RunContext(Engine& engine,
+ Raul::RingBuffer* event_sink,
+ unsigned id,
+ bool threaded)
: _engine(engine)
- , _event_sink(
- new Raul::RingBuffer(engine.event_queue_size() * sizeof(Notification)))
+ , _event_sink(event_sink)
, _task(nullptr)
, _thread(threaded ? new std::thread(&RunContext::run, this) : nullptr)
, _id(id)
@@ -58,7 +60,6 @@ RunContext::RunContext(Engine& engine, unsigned id, bool threaded)
, _offset(0)
, _nframes(0)
, _realtime(true)
- , _copy(false)
{}
RunContext::RunContext(const RunContext& copy)
@@ -72,15 +73,10 @@ RunContext::RunContext(const RunContext& copy)
, _offset(copy._offset)
, _nframes(copy._nframes)
, _realtime(copy._realtime)
- , _copy(true)
{}
RunContext::~RunContext()
-{
- if (!_copy) {
- delete _event_sink;
- }
-}
+{}
bool
RunContext::must_notify(const PortImpl* port) const
@@ -101,9 +97,9 @@ RunContext::notify(LV2_URID key,
return false;
}
if (_event_sink->write(sizeof(n), &n) != sizeof(n)) {
- _engine.log().error("Error writing header to notification ring\n");
+ _engine.log().rt_error("Error writing header to notification ring\n");
} else if (_event_sink->write(size, body) != size) {
- _engine.log().error("Error writing body to notification ring\n");
+ _engine.log().rt_error("Error writing body to notification ring\n");
} else {
return true;
}
@@ -135,13 +131,13 @@ RunContext::emit_notifications(FrameTime end)
note.port->set_property(uris.ingen_value, value);
}
} else {
- _engine.log().error("Error unmapping notification key URI\n");
+ _engine.log().rt_error("Error unmapping notification key URI\n");
}
} else {
- _engine.log().error("Error reading body from notification ring\n");
+ _engine.log().rt_error("Error reading body from notification ring\n");
}
} else {
- _engine.log().error("Error reading header from notification ring\n");
+ _engine.log().rt_error("Error reading header from notification ring\n");
}
}
}