This commit is contained in:
parent
c07f3ebf81
commit
9b5719f9be
17 changed files with 612 additions and 308 deletions
|
@ -1,34 +1,25 @@
|
|||
#include "./thread_mgr.hpp"
|
||||
#include "../socket/socket.hpp"
|
||||
#include "../backends/file_backend.hpp"
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
#include "../socket/socket.hpp"
|
||||
|
||||
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;
|
||||
std::vector<socket::listener*>& _listen_sockets;
|
||||
bool _nonblocking;
|
||||
std::mutex _run_lock;
|
||||
int _max_threads;
|
||||
int _max_clients;
|
||||
|
||||
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*);
|
||||
bool event_handler(socket::server*);
|
||||
|
||||
public:
|
||||
event_loop(backends::backend& backend, config::config& config);
|
||||
event_loop(std::vector<socket::listener*>&, backends::backend& backend, int max_workers, int max_clients);
|
||||
void start() override;
|
||||
void stop() override;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue