2

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?

siri
  • 123
  • 1
  • 13
  • 1
    The thread can modify it, but it won't have any effect if `poll()` has already started. The array is copied into the kernel at the start of the system call. – user207421 May 17 '17 at 21:24

0 Answers0