diff options
Diffstat (limited to 'src/server/Worker.hpp')
-rw-r--r-- | src/server/Worker.hpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/server/Worker.hpp b/src/server/Worker.hpp index 2e4a965f..08b75509 100644 --- a/src/server/Worker.hpp +++ b/src/server/Worker.hpp @@ -17,13 +17,14 @@ #ifndef INGEN_ENGINE_WORKER_HPP #define INGEN_ENGINE_WORKER_HPP -#include "ingen/LV2Features.hpp" -#include "ingen/types.hpp" -#include "lv2/worker/worker.h" -#include "raul/RingBuffer.hpp" -#include "raul/Semaphore.hpp" +#include <ingen/LV2Features.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 { @@ -41,11 +42,11 @@ public: ~Worker(); struct Schedule : public LV2Features::Feature { - Schedule(bool sync) : synchronous(sync) {} + explicit 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 +55,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(); }; |