davidmoreno / onion

C library to create simple HTTP servers and Web Applications.
http://www.coralbits.com/libonion/
Other
2.02k stars 250 forks source link

should use edge triggered mode (EPOLLET) for client fd #235

Closed yzf closed 6 years ago

yzf commented 6 years ago

It seems that with O_POOL option and epoll support, onion will use the same epollfd in multi-thread. In level triggered mode (default), if the thread wake up from epoll_wait not read the data immediately or with some delay, other thread may also wake up and read some of the data, which will lead to logic error. So, I think it's reasonable to use edge triggered mode (EPOLLET) for client fd.

davidmoreno commented 6 years ago

It will not happen as the polling of that fd is deactivated by epoll itself (EPOLLONESHOT) and have to be forcefully readded (poller.c:567).