Sign in to follow this  
Evil Steve

WSAWaitForMultipleEvents from multiple threads

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this