I have a dedicated polling thread that does the poll() system call. On an event a worker thread is posted to do actual read/write from the network. The polling thread disables the fd for an event if it is being worked upon by the worker thread. Once the worker thread is finished with the read/write it reenables the fd for polling.
Can the worker thread directly modify the pollfd array that poll() uses? Will there be any issues if the pollfd array is modified while it is passed to the poll() invocation?