epoll_wait, epoll_ctl
So, what's supposed to happen in a threaded program where one thread does an epoll_ctl on an epoll fd while another thread is currently waiting in epoll_wait on the same fd? In particular, what happens if a thread does an EPOLL_CTL_DEL on one of the fds that is currently being waited on? Is there a possibility of an event being returned on the fd even after the EPOLL_CTL_DEL completes?
Signature · 4 lines
-- Howard Chu Chief Architect, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc OpenLDAP Core Team http://www.openldap.org/project/
Quoted 1 line · Howard Chu
So, what's supposed to happen in a threaded program where one thread does an
epoll_ctlon an epoll fd while another thread is currently waiting inepoll_waiton the same fd? In particular, what happens if a thread does anEPOLL_CTL_DELon one of the fds that is currently being waited on? Is there a possibility of an event being returned on the fd even after theEPOLL_CTL_DELcompletes?
The same thing that happens when you close a file on another thread, nothing (besides the file being automatically removed from the set). Removing a file (either by close or by EPOLL_CTL_DEL) is not an event.
- Davide
Quoted 4 lines
So, what's supposed to happen in a threaded program where one thread does an
epoll_ctlon an epoll fd while another thread is currently waiting inepoll_waiton the same fd?
Nothing special.
Quoted 4 lines
In particular, what happens if a
thread does anEPOLL_CTL_DELon one of the fds that is currently being waited on? Is there a possibility of an event being returned on the fd even after theEPOLL_CTL_DELcompletes?
Absolutely. The EPOLL_CTL_DEL might not even start until after the event
has been determined to be returned and the wait is in the process of returning.
DS