Jump to content
  • Advertisement
Sign in to follow this  
Evil Steve

WSAWaitForMultipleEvents from multiple threads

This topic is 4493 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm thinking of changing my server code over to use WSAEventSelect. I was going to have 2*num_cpu threads handling the event processing, and the easiest way I thought to do this was a bit like IO completion ports; have the threads all waiting for an event and get one to dequeue one. However, I suspect that when one of the sockets becomes signalled, all the threads will leap into action, correct? What would be the best (most efficient) way of handling this? I could have one thread for every 512 sockets, or something like that, but I'm not sure what the best way actually is. Also, is there a limit to the number of events you can pass to WSAWaitForMultipleEvents? There isn't one mentioned, but I suspect that trying to wait for 65535 events would be A Bad Thing...

Share this post


Link to post
Share on other sites
Advertisement
If the event is auto-reset, then only one thread will start running when it is pulsed.

However, emulating IOCP when IOCP is already there seems kind-of pointless (but no doubt fun to get to work :-)

Share this post


Link to post
Share on other sites
Quote:
Original post by kuphryn
Correct.

WSA_MAXIMUM_WAIT_EVENTS
Wah! That's only 64 handles. That'll be a lot of threads... I might just go back to look at my IOCP code I think. I'll try to get a really simple test application running so I can get all you to debug it for me [wink]

Thanks for the replies.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!