diff options
Diffstat (limited to 'src/server/RunContext.hpp')
-rw-r--r-- | src/server/RunContext.hpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/server/RunContext.hpp b/src/server/RunContext.hpp index 87fb0fed..939371e7 100644 --- a/src/server/RunContext.hpp +++ b/src/server/RunContext.hpp @@ -23,11 +23,13 @@ #include "ingen/World.hpp" #include "raul/RingBuffer.hpp" +#include "Runner.hpp" #include "types.hpp" namespace Ingen { namespace Server { +class BlockImpl; class Engine; class PortImpl; class Task; @@ -44,9 +46,11 @@ class Task; * * \ingroup engine */ -class RunContext +class RunContext : public Runner { public: + using BlockTask = Task; + /** Create a new run context. * * @param engine The engine this context is running within. @@ -115,10 +119,13 @@ public: } /** Claim a parallel task, and signal others that work is available. */ - void claim_task(Task* task); + void claim_task(BlockTask* task) override; /** Steal a task from some other context if possible. */ - Task* steal_task() const; + BlockTask* steal_task() const override; + + /** Run `unit`. */ + void run_unit(BlockImpl* unit) override; void set_priority(int priority); void set_rate(SampleCount rate) { _rate = rate; } @@ -126,7 +133,7 @@ public: void join(); inline Engine& engine() const { return _engine; } - inline Task* task() const { return _task; } + inline BlockTask* task() const { return _task; } inline unsigned id() const { return _id; } inline FrameTime start() const { return _start; } inline FrameTime time() const { return _start + _offset; } @@ -143,7 +150,7 @@ protected: Engine& _engine; ///< Engine we're running in Raul::RingBuffer* _event_sink; ///< Port updates from process context - Task* _task; ///< Currently executing task + BlockTask* _task; ///< Currently executing task std::thread* _thread; ///< Thread (NULL for main run context) unsigned _id; ///< Context ID |