diff options
Diffstat (limited to 'src/server/Worker.hpp')
-rw-r--r-- | src/server/Worker.hpp | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/server/Worker.hpp b/src/server/Worker.hpp index 2e4a965f..540347df 100644 --- a/src/server/Worker.hpp +++ b/src/server/Worker.hpp @@ -18,17 +18,20 @@ #define INGEN_ENGINE_WORKER_HPP #include "ingen/LV2Features.hpp" -#include "ingen/types.hpp" +#include "lv2/core/lv2.h" #include "lv2/worker/worker.h" #include "raul/RingBuffer.hpp" #include "raul/Semaphore.hpp" #include <cstdint> +#include <memory> #include <thread> namespace ingen { class Log; +class Node; +class World; namespace server { @@ -41,11 +44,11 @@ public: ~Worker(); struct Schedule : public LV2Features::Feature { - Schedule(bool sync) : synchronous(sync) {} + Schedule(bool sync) noexcept : synchronous(sync) {} const char* uri() const override { return LV2_WORKER__schedule; } - SPtr<LV2_Feature> feature(World& world, Node* n) override; + std::shared_ptr<LV2_Feature> feature(World& world, Node* n) override; const bool synchronous; }; @@ -54,20 +57,20 @@ public: uint32_t size, const void* data); - SPtr<Schedule> schedule_feature() { return _schedule; } + std::shared_ptr<Schedule> schedule_feature() { return _schedule; } private: - SPtr<Schedule> _schedule; - - Log& _log; - Raul::Semaphore _sem; - Raul::RingBuffer _requests; - Raul::RingBuffer _responses; - uint8_t* const _buffer; - const uint32_t _buffer_size; - UPtr<std::thread> _thread; - bool _exit_flag; - bool _synchronous; + std::shared_ptr<Schedule> _schedule; + + Log& _log; + raul::Semaphore _sem{0}; + raul::RingBuffer _requests; + raul::RingBuffer _responses; + uint8_t* const _buffer; + const uint32_t _buffer_size; + std::unique_ptr<std::thread> _thread; + bool _exit_flag{false}; + bool _synchronous; void run(); }; |