How to implement waitAny on more than 64 pens?

How to implement waitAny on more than 64 descriptors?

I have a simple problem, I have many threads running until the end of the data, when the stream is the end of the data, and then signals the stream that I am running this waitAny for idle time and giving it the next data packet.

+4
source share
3 answers

You might want to implement something like a queue for notification packets for a waitAny thread to wait. When one of your multiple threads terminates, it puts a notification packet in the queue. Your waitAny turns into waiting for a single event that indicates that something is in the queue.

+5
source

Implement cascading expectations with additional threads to wait for the WaitHandles packet and signal others about the hierarchy.

Or test them in arrays without actual expectations (no timeout)

+3
source

Effective waiting is limited by the API MAXIMUM_WAIT_OBJECTS , which is 64. In addition to the fact that your application is redesigned to use fewer descriptors, you can either switch to polling mode (wait for each of 64 separately with zero latency, -zero if all descriptors are not signaled ), or separate objects and wait between multiple threads of execution.

You can also return to previous discussions, for example.

+1
source

Source: https://habr.com/ru/post/1394017/


All Articles