-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathepoll.h
32 lines (30 loc) · 938 Bytes
/
epoll.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//
// Created by Jason.Z on 2020/6/24.
//
#ifndef SOCKETSERVERCPLUS_EPOLL_H
#define SOCKETSERVERCPLUS_EPOLL_H
#include <vector>
#include <unordered_map>
#include <sys/epoll.h>
#include <memory>
/**
* @struct Epoll
* @brief ZJX's Epoll struct
*
* @var epoll_fd File descriptor that indicates the event-list
* @var events epoll_events list
*/
class Epoll{
public:
static epoll_event *events;
static int epoll_fd;
public:
static int epoll_init(int max_events, int listen_num);
static int epoll_add(int fd, __uint32_t events);
static int epoll_mod(int fd, __uint32_t events);
static int epoll_del(int fd, __uint32_t events = (EPOLLIN | EPOLLET | EPOLLONESHOT));
static int zjx_epoll_wait(int listen_fd, int max_event, int timeout);
static int zjx_deal(int listen_fd, int ready_num);
static void acceptConnection(int listen_fd, int epoll_fd);
};
#endif //SOCKETSERVERCPLUS_EPOLL_H