G
Guest
Hi,
I am using FileStream's Async API: BeginRead/EndRead, upon completion callback execution I use the read data and call EndRead, Taking that in mind, I Wonder... does calling EndRead will cause a context switch? What is the kernel object used for blocking EndRead calls? Event and mutex cause a context switch even when the object is signaled and no wait is needed, usage of critical section prevent this switch from happening... what is the object used by EndRead? will it cause a context switch? My Guess is that the EndRead uses an Event as the OVERLAPPED structure used with IO Completion routines use an event for completion indications, if my assumption is true calling EndRead from the completion callback will cause an un-neccesary context switch, one that can be saved by querying the amount of bytes read in a way other then calling EndRead... ( is there such a way? Is there a non-explicit interface to IAsyncResponce? Can it be cast to somewhat more detailed structure? )
Note that I use EndRead in the completion callback merely to get the amount of bytes read, if I could get this amount by in a way other then calling EndRead It would solve the problem... Is there another way of getting the amount of read bytes? is there a way of extracting the internal OVERLAPPED structure from the IAsyncResult object?
Nadav
http://www.ddevel.com
I am using FileStream's Async API: BeginRead/EndRead, upon completion callback execution I use the read data and call EndRead, Taking that in mind, I Wonder... does calling EndRead will cause a context switch? What is the kernel object used for blocking EndRead calls? Event and mutex cause a context switch even when the object is signaled and no wait is needed, usage of critical section prevent this switch from happening... what is the object used by EndRead? will it cause a context switch? My Guess is that the EndRead uses an Event as the OVERLAPPED structure used with IO Completion routines use an event for completion indications, if my assumption is true calling EndRead from the completion callback will cause an un-neccesary context switch, one that can be saved by querying the amount of bytes read in a way other then calling EndRead... ( is there such a way? Is there a non-explicit interface to IAsyncResponce? Can it be cast to somewhat more detailed structure? )
Note that I use EndRead in the completion callback merely to get the amount of bytes read, if I could get this amount by in a way other then calling EndRead It would solve the problem... Is there another way of getting the amount of read bytes? is there a way of extracting the internal OVERLAPPED structure from the IAsyncResult object?
Nadav
http://www.ddevel.com