summaryrefslogtreecommitdiffstats
path: root/src/server/PreProcessor.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/PreProcessor.hpp')
-rw-r--r--src/server/PreProcessor.hpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/server/PreProcessor.hpp b/src/server/PreProcessor.hpp
index 05027638..e0b0cc4a 100644
--- a/src/server/PreProcessor.hpp
+++ b/src/server/PreProcessor.hpp
@@ -27,8 +27,7 @@
#include <mutex>
#include <thread>
-namespace ingen {
-namespace server {
+namespace ingen::server {
class Engine;
class PostProcessor;
@@ -42,7 +41,7 @@ public:
~PreProcessor();
/** Return true iff no events are enqueued. */
- inline bool empty() const { return !_head.load(); }
+ bool empty() const { return !_head.load(); }
/** Enqueue an event.
* This is safe to call from any non-realtime thread (it locks).
@@ -61,11 +60,11 @@ protected:
private:
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
+ 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
};
void wait_for_block_state(const BlockState state) {
@@ -76,15 +75,14 @@ private:
Engine& _engine;
std::mutex _mutex;
- raul::Semaphore _sem;
- std::atomic<Event*> _head;
- std::atomic<Event*> _tail;
- std::atomic<BlockState> _block_state;
- bool _exit_flag;
+ raul::Semaphore _sem{0};
+ std::atomic<Event*> _head{nullptr};
+ std::atomic<Event*> _tail{nullptr};
+ std::atomic<BlockState> _block_state{BlockState::UNBLOCKED};
+ bool _exit_flag{false};
std::thread _thread;
};
-} // namespace server
-} // namespace ingen
+} // namespace ingen::server
#endif // INGEN_ENGINE_PREPROCESSOR_HPP