anthracite/lib/thread_mgr/event_loop.hpp
Nicholas Orlowsky c07f3ebf81
Some checks failed
Docker Build & Publish / build (push) Failing after 1h24m16s
faster nonblocking io
2025-02-23 17:06:32 -05:00

36 lines
1.3 KiB
C++

#include "./thread_mgr.hpp"
#include "../socket/socket.hpp"
#include "../backends/file_backend.hpp"
#include <chrono>
#include <condition_variable>
#include <mutex>
#include <queue>
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, 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;
backends::file_backend _error_backend;
bool _nonblocking;
void worker_thread_loop(int threadno);
void listener_thread_loop(config::http_config& http_config);
void eventer_thread_loop();
bool event_handler(socket::anthracite_socket*);
public:
event_loop(backends::backend& backend, config::config& config);
void start() override;
void stop() override;
};
};