To assign a thread for each module, a design method is reliable

The basic idea: assign a thread for each module, network module is such a thread, when the network collecting data, as far as possible, then once in the buffer queue, other module for processing the processing time slice, and then set back to the sending queue, when the network module send, send a as much as possible.

1, When the network to send and receive data, now I live in other module is lock, do not let them get time processing segment, whether it would be efficiency?
2, A module polling, my idea is when there is no network news, network module will be blocked in select/epoll_wait this place, but other modules if no message to process, what should be used to prevent idling better blocking?

Started by Vernon at December 02, 2016 - 11:50 PM

Inter thread communication using the queue, epoll pipe1 byte means to awaken.

Posted by Dave at December 18, 2016 - 12:14 AM