#pragma once #include #include #include #include #include #include #include #include namespace simple_rcon { class CommandQueue { public: using Executor = std::function; explicit CommandQueue(Executor executor); std::string enqueue_and_wait(const std::string& command, std::chrono::milliseconds timeout); int drain(int max_items = 32); void shutdown(); private: struct Task { std::string command; std::promise result; }; Executor m_executor; std::mutex m_mutex; std::queue> m_tasks; bool m_stopping{false}; }; }