started reactor refactoring
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <chrono>
|
||||
#include <queue>
|
||||
#include <list>
|
||||
#include <shared_mutex>
|
||||
|
||||
namespace matador::net {
|
||||
|
||||
@@ -56,8 +57,8 @@ public:
|
||||
void run();
|
||||
void handle_events();
|
||||
void shutdown();
|
||||
bool is_running() const { return running_; }
|
||||
select_fdsets fdsets() const;
|
||||
[[nodiscard]] bool is_running() const { return running_; }
|
||||
select_fdsets fd_sets() const;
|
||||
void mark_handler_for_delete(const handler_ptr& h);
|
||||
void activate_handler(const handler_ptr& h, event_type ev);
|
||||
void deactivate_handler(const handler_ptr& h, event_type ev);
|
||||
@@ -65,7 +66,7 @@ public:
|
||||
|
||||
private:
|
||||
struct TimerEvent {
|
||||
time_t timeout;
|
||||
time_t timeout{};
|
||||
handler_weak_ptr handler;
|
||||
|
||||
bool operator>(const TimerEvent& other) const {
|
||||
@@ -89,7 +90,7 @@ private:
|
||||
|
||||
HandlerEntry* find_handler_entry(const handler_ptr& h);
|
||||
void remove_handler_entry(const handler_ptr& h);
|
||||
void update_handler_events(HandlerEntry* entry, event_type ev, bool activate);
|
||||
static void update_handler_events(HandlerEntry* entry, event_type ev, bool activate);
|
||||
|
||||
private:
|
||||
handler_map handlers_;
|
||||
@@ -100,12 +101,13 @@ private:
|
||||
|
||||
mutable std::shared_mutex handlers_mutex_;
|
||||
std::mutex timers_mutex_;
|
||||
std::condition_variable shutdown_cv_;
|
||||
std::condition_variable_any shutdown_cv_;
|
||||
// std::condition_variable shutdown_cv_;
|
||||
|
||||
logger log_;
|
||||
logger::logger log_;
|
||||
Statistics stats_;
|
||||
|
||||
leader_follower_thread_pool thread_pool_;
|
||||
utils::leader_follower_thread_pool thread_pool_;
|
||||
socket_interrupter interrupter_;
|
||||
|
||||
static constexpr std::chrono::seconds CLEANUP_INTERVAL{60};
|
||||
|
||||
Reference in New Issue
Block a user