#pragma once #include #include #include "arb.h" typedef std::variant LogcatThreadItem; class LogcatThread { public: // https://stackoverflow.com/a/2173764 LogcatThread(const LogcatThread&) = delete; LogcatThread& operator=(const LogcatThread&) = delete; LogcatThread(); ~LogcatThread(); void request_stop(); void join(); AtomicRingBuffer atomic_ring_buffer; private: void _run(std::stop_token stoken); int _epoll_fd = -1; int _stdout_read_fd = -1; int _stdout_write_fd = -1; int _stderr_read_fd = -1; int _stderr_write_fd = -1; std::stop_source _stop_source; std::thread _thread; };