C #: is there any reason to approve an asynchronous socket call for synchronous calls in my own thread pool?

Is there a performance advantage when calling BeginGetResponse vs. calling GetResponse in my own thread pool? The advantage of my own pool is that I can control the request queue.

Thank!

+3
source share
1 answer

When you call GetResponse, even if you call it in the ThreadPool background thread, the THAT thread will still be blocked and will not be able to go and do other work. This means context switching, etc. However, if you use BeginGetResponse, then it offloads the work to the network card, and, most importantly, the calling thread is now free to do and do other work. When the network card is completed, it will notify your application, and at that moment a callback will be called.

+1
source

All Articles