Allenxuxu / gev

🚀Gev is a lightweight, fast non-blocking TCP network library / websocket server based on Reactor mode. Support custom protocols to quickly and easily build high-performance servers.
MIT License
1.72k stars 193 forks source link

EPOLLET or EPOLLLT? #106

Closed zhongweikang closed 2 years ago

zhongweikang commented 2 years ago

大佬好,我全局搜索了代码,没有找到类似 EPOLLET 或者 EPOLLLT 字样的代码,是否就意味着,默认使用的是 EPOLLLT 水平触发?

const readEvent = unix.EPOLLIN | unix.EPOLLPRI
const writeEvent = unix.EPOLLOUT
Allenxuxu commented 2 years ago

大佬好,我全局搜索了代码,没有找到类似 EPOLLET 或者 EPOLLLT 字样的代码,是否就意味着,默认使用的是 EPOLLLT 水平触发?

const readEvent = unix.EPOLLIN | unix.EPOLLPRI
const writeEvent = unix.EPOLLOUT

是的

zhongweikang commented 2 years ago

使用 EPOLLLT 而不是 EPOLLET 是有什么考量么?

Allenxuxu commented 2 years ago

使用 EPOLLLT 而不是 EPOLLET 是有什么考量么?

水平触发,代码上处理相对简单,不需要一直读尽,不容易出错,并且 et 未必比 lt 快。

zhongweikang commented 2 years ago

好的,感谢解答~