1 Star 0 Fork 1

taozier/roughserver

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Epoller.h 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
taozier 提交于 2020-06-03 04:52 . first commit
#pragma once
#include "noncopyable.h"
#include "Timer.h"
#include "Channel.h"
#include <map>
#include <vector>
#include <memory>
//#include <unordered_map>
class HTTPData;
class Epoller : noncopyable
{
public:
typedef std::vector<ChannelSP> ChannelSPVector;
Epoller();
~Epoller();
void epoll_add(ChannelSP channel, int timeout);
void epoll_mod(ChannelSP channel, int timeout);
void epoll_del(ChannelSP channel);
int poll(ChannelSPVector *activeChannels);
void getActiveChannels(int numEvents, ChannelSPVector* activeChannels);
void setTimer(ChannelSP channel, int timeout);
int getEpollfd() const { return epollfd_; }
void handleExpired();
private:
//static const int MAXFDS = 100000;
static const int eventsSize = 4096;
static const int epollTimeout = 10000;
int epollfd_;
std::vector<epoll_event> events_;
typedef std::map<int, ChannelSP> ChannelSPMap;
ChannelSPMap channels_;
//std::shared_ptr<Channel> fd2chan_[MAXFDS];
typedef std::map<int, std::shared_ptr<HTTPData> > HTTPDataSPMap;
HTTPDataSPMap httpdatas_;
//std::shared_ptr<HTTPData> fd2http_[MAXFDS];
TimerManager timerManager_;
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/taozier/roughserver.git
git@gitee.com:taozier/roughserver.git
taozier
roughserver
roughserver
master

搜索帮助