mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-06 15:51:25 +00:00
Enable epoll on linux
This commit is contained in:
1 parent
4702073458
commit
51cb40acd2
8 files changed
+148
-6
No files matched your search
@@ -12,6 +12,10 @@
|
||||
#define MG_ENABLE_POLL 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_EPOLL
|
||||
#define MG_ENABLE_EPOLL 0
|
||||
#endif
|
||||
|
||||
#ifndef MG_ENABLE_FATFS
|
||||
#define MG_ENABLE_FATFS 0
|
||||
#endif
|
||||
@@ -106,3 +110,20 @@
|
||||
#define MG_ENABLE_FILE 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if MG_ENABLE_EPOLL
|
||||
#define MG_EPOLL_ADD(c) \
|
||||
do { \
|
||||
struct epoll_event ev = {EPOLLIN | EPOLLERR | EPOLLHUP, {c}}; \
|
||||
epoll_ctl(c->mgr->epoll_fd, EPOLL_CTL_ADD, (int) (size_t) c->fd, &ev); \
|
||||
} while (0)
|
||||
#define MG_EPOLL_MOD(c, wr) \
|
||||
do { \
|
||||
struct epoll_event ev = {EPOLLIN | EPOLLERR | EPOLLHUP, {c}}; \
|
||||
if (wr) ev.events |= EPOLLOUT; \
|
||||
epoll_ctl(c->mgr->epoll_fd, EPOLL_CTL_MOD, (int) (size_t) c->fd, &ev); \
|
||||
} while (0)
|
||||
#else
|
||||
#define MG_EPOLL_ADD(c)
|
||||
#define MG_EPOLL_MOD(c, wr)
|
||||
#endif
|
||||
Reference in new issue
Block a user