Add ringloop back to timerfd
This commit is contained in:
+7
-3
@@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <time.h>
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
#include "ringloop.h"
|
||||
|
||||
struct timerfd_timer_t
|
||||
{
|
||||
@@ -20,15 +19,20 @@ class timerfd_manager_t
|
||||
int nearest = -1;
|
||||
int id = 1;
|
||||
std::vector<timerfd_timer_t> timers;
|
||||
ring_loop_t *ringloop;
|
||||
ring_consumer_t consumer;
|
||||
|
||||
void inc_timer(timerfd_timer_t & t);
|
||||
void set_nearest();
|
||||
void trigger_nearest();
|
||||
void handle_readable();
|
||||
void set_wait();
|
||||
void loop();
|
||||
public:
|
||||
// FIXME shouldn't be here
|
||||
std::function<void(int, std::function<void(int, int)>)> set_fd_handler;
|
||||
|
||||
timerfd_manager_t(std::function<void(int, std::function<void(int, int)>)> set_fd_handler);
|
||||
timerfd_manager_t(ring_loop_t *ringloop);
|
||||
~timerfd_manager_t();
|
||||
int set_timer(uint64_t millis, bool repeat, std::function<void(int)> callback);
|
||||
void clear_timer(int timer_id);
|
||||
|
||||
Reference in New Issue
Block a user