#ifndef COMMANDDISPATCHER_H #define COMMANDDISPATCHER_H #include #include #include "Task.h" namespace nemo_interface { class CommandDispatcher : public QThread { public: CommandDispatcher(); bool interruptionPoint(); // thread safe std::future dispatch(const Task &c); // thread safe std::future dispatchNext(const Task &c); // thread safe void clear(); // thread safe void stop(); // thread safe bool running(); // thread safe private: std::atomic_bool _running; std::condition_variable _condVar; QList _queue; std::mutex _queueMutex; }; } // namespace nemo_interface #endif // COMMANDDISPATCHER_H