diff options
Diffstat (limited to 'src/server/Worker.cpp')
-rw-r--r-- | src/server/Worker.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/server/Worker.cpp b/src/server/Worker.cpp index 77d98612..cf252d37 100644 --- a/src/server/Worker.cpp +++ b/src/server/Worker.cpp @@ -24,6 +24,8 @@ #include "ingen/Node.hpp" #include "lv2/core/lv2.h" #include "lv2/worker/worker.h" +#include "raul/RingBuffer.hpp" +#include "raul/Semaphore.hpp" #include <cstdlib> #include <memory> @@ -36,9 +38,9 @@ namespace server { /// A message in the Worker::_requests ring struct MessageHeader { - LV2Block* block; ///< Node this message is from + LV2Block* block; ///< Node this message is from uint32_t size; ///< Size of following data - // `size' bytes of data follow here + // `size' bytes of data follow here }; static LV2_Worker_Status @@ -46,8 +48,8 @@ schedule(LV2_Worker_Schedule_Handle handle, uint32_t size, const void* data) { - auto* block = static_cast<LV2Block*>(handle); - Engine& engine = block->parent_graph()->engine(); + auto* block = static_cast<LV2Block*>(handle); + const Engine& engine = block->parent_graph()->engine(); return engine.worker()->request(block, size, data); } @@ -57,8 +59,8 @@ schedule_sync(LV2_Worker_Schedule_Handle handle, uint32_t size, const void* data) { - auto* block = static_cast<LV2Block*>(handle); - Engine& engine = block->parent_graph()->engine(); + auto* block = static_cast<LV2Block*>(handle); + const Engine& engine = block->parent_graph()->engine(); return engine.sync_worker()->request(block, size, data); } @@ -72,7 +74,7 @@ Worker::request(LV2Block* block, return block->work(size, data); } - Engine& engine = block->parent_graph()->engine(); + const Engine& engine = block->parent_graph()->engine(); if (_requests.write_space() < sizeof(MessageHeader) + size) { engine.log().error("Work request ring overflow\n"); return LV2_WORKER_ERR_NO_SPACE; @@ -110,19 +112,17 @@ Worker::Schedule::feature(World&, Node* n) f->URI = LV2_WORKER__schedule; f->data = data; - return std::shared_ptr<LV2_Feature>(f, &free_feature); + return {f, &free_feature}; } Worker::Worker(Log& log, uint32_t buffer_size, bool synchronous) : _schedule(new Schedule(synchronous)) , _log(log) - , _sem(0) , _requests(buffer_size) , _responses(buffer_size) , _buffer(static_cast<uint8_t*>(malloc(buffer_size))) , _buffer_size(buffer_size) , _thread(nullptr) - , _exit_flag(false) , _synchronous(synchronous) { if (!synchronous) { |