Sign in to follow this  
TiitHns

IOCP threads

Recommended Posts

TiitHns    122
Does having different threads one for sending and another for recv have any benefits? And if its good way is there any tutorial about it.

Share this post


Link to post
Share on other sites
Antheus    2409
The whole point of IOCP is that you have a thread pool. These threads are then invoked as needed and run your code. As such, IOCP is multi-threaded by definition.

But, tasks are invoked in threads as needed. This means that no matter how big your pool is, only a minimally necessary number of threads in it will be active at any given time. Realistic number will be around 2x the number of cores.

When you look into IOCP event handling, you'll notice that code is operation agnostic - there is no strict distinction between send and receive - you respond to events.

OS takes care of everything else, including invoking event handlers in separate threads, if needed.

So no, having manually managed send/receive threads doesn't make sense with IOCP.

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