diff options
author | David Robillard <d@drobilla.net> | 2016-09-18 08:24:25 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-09-18 11:43:30 -0400 |
commit | a43528ab069f325e68dab6e18cf2cab19cc22e56 (patch) | |
tree | acecc484fa015c063c6361baa03616202d336e89 /src/server/PreProcessor.hpp | |
parent | ce6dc3d549bc58515d5d55db1d0a009a92887f3c (diff) | |
download | ingen-a43528ab069f325e68dab6e18cf2cab19cc22e56.tar.gz ingen-a43528ab069f325e68dab6e18cf2cab19cc22e56.tar.bz2 ingen-a43528ab069f325e68dab6e18cf2cab19cc22e56.zip |
Clean up code
Diffstat (limited to 'src/server/PreProcessor.hpp')
-rw-r--r-- | src/server/PreProcessor.hpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/server/PreProcessor.hpp b/src/server/PreProcessor.hpp index f9b85c8f..5dc7bef0 100644 --- a/src/server/PreProcessor.hpp +++ b/src/server/PreProcessor.hpp @@ -49,22 +49,31 @@ public: /** Process events for a cycle. * @return The number of events processed. */ - unsigned process(RunContext& context, - PostProcessor& dest, - size_t limit = 0); + unsigned process(RunContext& context, + PostProcessor& dest, + size_t limit = 0); protected: void run(); private: - Engine& _engine; - std::mutex _mutex; - Raul::Semaphore _sem; - std::atomic<Event*> _head; - std::atomic<Event*> _prepared_back; - std::atomic<Event*> _tail; - bool _exit_flag; - std::thread _thread; + enum class BlockState { + UNBLOCKED, ///< Normal, unblocked execution + PRE_BLOCKED, ///< Preprocess thread has enqueued blocking event + BLOCKED, ///< Process thread has reached blocking event + PRE_UNBLOCKED, ///< Preprocess thread has enqueued unblocking event + PROCESSING ///< Process thread is executing all events in-between + }; + + Engine& _engine; + std::mutex _mutex; + Raul::Semaphore _sem; + std::atomic<Event*> _head; + std::atomic<Event*> _prepared_back; + std::atomic<Event*> _tail; + std::atomic<BlockState> _block_state; + bool _exit_flag; + std::thread _thread; }; } // namespace Server |