#pragma once
#include "common.hpp"
#include "pool.hpp"
#include "fdtable.hpp"
#include "test.hpp"
typedef struct tout_node_s {
struct tout_node_s* prev;
struct tout_node_s* next;
int fd;
time_t at;
} tout_node_t;
class ToutQueue {
private:
static TPool<tout_node_t> pool;
tout_node_t* head;
tout_node_t* tail;
FdTable<tout_node_t*> fds;
public:
ToutQueue();
~ToutQueue();
void push(int fd, time_t now); ///< push into queue as last one active
int pop(time_t tout); ///< timeouted fd(s) or -1
bool pop(int fd); ///< try to remove from queue (got an event)
};