I'm monitoring list of socket fds and wait POLLIN events.
First I add fds to array and run poll() on this array. Further, in some cases I want to delete fd from this array(without closing). And sometimes it may occurs concurrently with poll() was running.
As I understood when poll() starting, kernel cached array with waitering pollfds, so it cannot to be able know that I delete fd immediately, right?
I found that we can to implement wakeup mechanism with eventfd() and use it for wake up our thread and delete fd from array, and after continue run poll() with new array.
First I want to ask that is it correct, that poll() not be know immediately if we will just delete fd from pollfds array concurrently with poll() running? And it's more for clarifying, maybe there some different mechanism for deleting fd from waitering pollfds array (excluding wakeup mechanism), that poll() will be interrupt immediately?