25 lines
		
	
	
		
			513 B
		
	
	
	
		
			C++
		
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			513 B
		
	
	
	
		
			C++
		
	
	
	
| #pragma once
 | |
| 
 | |
| #include <thread>
 | |
| 
 | |
| class LogcatThread {
 | |
| public:
 | |
|     // https://stackoverflow.com/a/2173764
 | |
|     LogcatThread(const LogcatThread&) = delete;
 | |
|     LogcatThread& operator=(const LogcatThread&) = delete;
 | |
| 
 | |
|     LogcatThread(bool* run_event_loop);
 | |
|     ~LogcatThread();
 | |
|     void join();
 | |
| 
 | |
| private:
 | |
|     void _run(bool* run_event_loop);
 | |
| 
 | |
|     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::thread _thread;
 | |
| };
 |