Is Socket ReceiveFromAsync implicltly multi threaded?
I'm currently working on a high per开发者_运维百科formance Raw socket application.
I'm using ReceiveFromAsync to receive packets. This may sound like a silly question, but is this implicitly threaded? I'm not sure if i need to take the received packet and thread off the handling to ensure I'm not blocking any additional packets while i handle the current one. The documentation does not really mention that. The sample code for the 3.5 sockets does not thread it so my initial guess was that its implicitly handled.
Thanks
All of the Async IO
functions create/utilize an IO Completion Port, which is a queue of requests submitted by a process. Whenever a process makes an Asynch IO call
this request is submitted on this queue. A special pool of threads then process these IO requests, these are kernel threads
. Therefore if you consider this system plumbing (these kernel threads
) as part of your multithreading yes your code is multithreaded.
If you consider the abstraction provided to you through Async IO
calls as your starting point, then probably your code is not multi-threaded.
In either case there are more than one threads are running even though they are not dedicated threads in your application, or they are created before your application started, and they would continue to run after your application exists.
精彩评论