Good day all.
I am in the process of moving our server application (mostly UDP) from a thread-per-socket strategy to IOCP. The IOCP part works well, however the treads that send/receive the data don't do the actual data processing. For now they save the received packets in a std::deque protected by a critical section.
The real work is done by another thread which is bound by a 100 millisecond cycle. And there seems to be the problem, the insertion/retrieval from the deque introduces delays that cause logical problems down the road. Essentially I have a single consumer / multiple producers type of scenario.
I debugged and profiled and my conclusion is that it is a thread starvation. I tried to use an Event object to signal the thread that it can retrieve the data, but that also did not seem to help. Are there more efficient ways than using a CRITICAL_SECTION to protect the data structure?
Thanks in advance, Michael