This really is a “Read The Document” kinda question, but it is not happening
the way the DOCs are saying it should, hence the question:
Is it possible that the IO completion routine is called in the same thread
context as the one that originally called IoCallDriver?
DDK docs seem to suggest otherwise as it says “A driver’s IoCompletion
routine executes in an arbitrary thread or DPC ontext” (Ref: IoCompletion in
DDK doc).
In my TDI client driver, with one specific NIC card, I see that the send
completion routine is called in the same thread context as the one doing
the send (thread that called IoCallDriver).
I need to acquire a lock in the completion routine which, if already
acquired in the send thread, leads to a deadlock if the completion routine
is called in the same context.
I can always queue a work item in the completion routine to avoid this but I
am curious if it is a problem with the NIC driver (as I see it happen only
with one particular NIC card) or am I reading the DOCs wrong?
TIA,
Bandeep