polished up event loop changes
Some checks failed
Docker Build & Publish / build (push) Failing after 55m49s

This commit is contained in:
Nicholas Orlowsky 2025-02-21 18:24:28 -05:00
parent 058c395095
commit 409024e04a
18 changed files with 354 additions and 428 deletions

View file

@ -1,6 +1,7 @@
#include "./thread_mgr.hpp"
#include "../socket/socket.hpp"
#include "../backends/file_backend.hpp"
#include <chrono>
#include <condition_variable>
#include <mutex>
#include <queue>
@ -9,11 +10,14 @@ namespace anthracite::thread_mgr {
class event_loop : public virtual thread_mgr {
class event {
socket::anthracite_socket* _socket;
std::chrono::time_point<std::chrono::high_resolution_clock> _ts;
public:
event(socket::anthracite_socket* socket);
event(socket::anthracite_socket* socket, std::chrono::time_point<std::chrono::high_resolution_clock> timestamp);
socket::anthracite_socket* socket();
std::chrono::time_point<std::chrono::high_resolution_clock>& timestamp();
};
int _epoll_fd;
std::mutex _event_mtx;
std::condition_variable _event_cv;
std::queue<event> _events;
@ -21,6 +25,7 @@ namespace anthracite::thread_mgr {
void worker_thread_loop(int threadno);
void listener_thread_loop(config::http_config& http_config);
void eventer_thread_loop();
bool event_handler(event& ev);
public: