Re: Calling a completion routine from within a completion routine

Are there problems with this option? The dispatch routine that received
the original IRP waits on an event that is set by the new completion
routine. The then old dispatch routine completes the original IRP.

Mark Roddy wrote:

Actually DISPATCH_LEVEL completion handling is the normal mode of
operation, as completion

processing is generally triggered by some form of interrupt driven
event, either a timer or a

hardware device interrupt.

The other problem noted is more serious, that the driver below you may
not expect

DISPATCH_LEVEL entry in his DispatchXXX routines, and if that is the
case then you are forced

into worker thread/work item solutions.

The third problem, which may or may not have been made explicit here is
that of recursion

between upper/lower drivers within completion handling, which can result
in fatal stack

overflow errors. You can test the amount of call stack remaining, and
use your own heuristics

to decide when you don’t have enough room left, or you can use some
other algorithm to

understand that you are recursing through your completion handler. Again
the solution is a

worlk item or worker thread.

===========================

Mark Roddy

Consultant, Microsoft DDK MVP

Hollis Technology Solutions

xxxxx@hollistech.com mailto:xxxxx

www.hollistech.com http:

603-321-1032

-----Original Message-----

From: “Don Burn” mailto:xxxxx

To: “NT Developers Interest List” mailto:xxxxx


Date: Sun, 9 Feb 2003 17:42:59 -0500

Subject: [ntdev] Re: Calling a completion routine from within a
completion routine

----- Original Message -----

From: mailto:xxxxx

To: “NT Developers Interest List” mailto:xxxxx


Sent: Sunday, February 09, 2003 3:35 PM

Subject: [ntdev] Calling a completion routine from within a completion

routine

I have a completion routine, in which I wish to call

IoSetCompletionRoutine() and IoCallDriver(), after creating my own

fresh

irp for the operation. The second completion routine finishes the new

irp,

the old one goes back up the stack.

Can I do this? Caveats?

Yes you can do this, be aware there is the possibility of the

completion

routine being called at DISPATCH_LEVEL, if your code, or the code

to be executed due to the IoCallDriver has a problem with that, you may

need to change your design.

Don Burn

Egenera, Inc



You are currently subscribed to ntdev as: xxxxx@hollistech.com
mailto:xxxxx

To unsubscribe send a blank email to xxxxx@lists.osr.com
mailto:xxxxx



You are currently subscribed to ntdev as: xxxxx@okena.com
mailto:xxxxx

To unsubscribe send a blank email to xxxxx@lists.osr.com
mailto:xxxxx</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></http:></mailto:xxxxx>