When we want to design a generic Event Handling (I/O Demultiplexing) or reactor pattern model. The underlying system call we use is "select" or "poll". But both of the system call is not thread safe on common set of FD's. Can not be used in Multithreading environment.
What would be the better approach to handle events with multiple threads across multiple I/O's.
The 1 way I can see is, main thread recv's any events and push into a shared queue of thread pool. But worker thread can not send the data over the I/O causes synchronization problems. Also has memory overflow disadvantage.
All possible suggestions are welcome. Thanks in Advance.