Cancel-Safe Queues

Hi everyone,

I would just like to get some input on cancel-safe queues. Are they easier to implement than interlocked queues? Is it worth changing our existing queues to cancel-safe ones?

Any comments/suggestions welcome.

Thanks, Chris

Cancel safe queues are an API set that’s really a wrapper around your queue implementation but abstracts the cancellation aspects of the design. For example you provide a callback routine to insert an IRP into a queue but call IoCsqInsertIrp to insert the IRP. By doing so, if the IRP is canceled the cancelation is handled automatically. You don’t have to worry about handling all the various race conditions.

You can find more detailed documentation in the DDK and I believe NT Insider had an article on it as well. Its definitely worth moving to cancel safe queues because handling the cancellation races are hard to write and using cancel safe queues means you are already using tested code that’s being used by other drivers. For example the audio stack in XP uses the cancel safe queues.


This posting is provided “AS IS” with no warranties, and confers no rights.
“Chris Dore” wrote in message news:xxxxx@ntdev…
Hi everyone,

I would just like to get some input on cancel-safe queues. Are they easier to implement than interlocked queues? Is it worth changing our existing queues to cancel-safe ones?

Any comments/suggestions welcome.

Thanks, Chris

Does anyone know where I can find a cancel-safe queue implemented in a real driver. The cancel source in the DDK is ok but I’d just like to see if I can find another example to whet my whistle. Since cancel-safe queues seem to be the way to go, are more of the sample drivers in the DDK going to be ported?

Chris
----- Original Message -----
From: Nar Ganapathy [MS]
Newsgroups: ntdev
To: NT Developers Interest List
Sent: Friday, June 21, 2002 12:24 PM
Subject: [ntdev] Re: Cancel-Safe Queues

Cancel safe queues are an API set that’s really a wrapper around your queue implementation but abstracts the cancellation aspects of the design. For example you provide a callback routine to insert an IRP into a queue but call IoCsqInsertIrp to insert the IRP. By doing so, if the IRP is canceled the cancelation is handled automatically. You don’t have to worry about handling all the various race conditions.

You can find more detailed documentation in the DDK and I believe NT Insider had an article on it as well. Its definitely worth moving to cancel safe queues because handling the cancellation races are hard to write and using cancel safe queues means you are already using tested code that’s being used by other drivers. For example the audio stack in XP uses the cancel safe queues.


This posting is provided “AS IS” with no warranties, and confers no rights.
“Chris Dore” wrote in message news:xxxxx@ntdev…
Hi everyone,

I would just like to get some input on cancel-safe queues. Are they easier to implement than interlocked queues? Is it worth changing our existing queues to cancel-safe ones?

Any comments/suggestions welcome.

Thanks, Chris

Check out mouclass / kbdclass under the input examples (the code in this case is 100% the same, just the function names are different).? They have cancel safe queues which are implemented entirely within the driver (they were written before the system provided CSQs were available).? These 2 drivers have the basic producer / consumer problem where you must queue data if there is no current consumer or queue the consumer (the read irp) untilt here is data.? The read dispatch function (potentially) enqueues the irps and KeyboardClassServiceCallback / MouseClassServiceCallback does the dequeue.
?
d

This posting is provided “AS IS” with no warranties, and confers no rights.

-----Original Message-----
From: Chris Dore [mailto:xxxxx@connecttech.com]
Sent: Friday, June 21, 2002 11:34 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Cancel-Safe Queues
?
Does anyone know where I can find a cancel-safe queue implemented in a real driver. The cancel source in the DDK is ok but I’d just like to see if I can find another example to whet my whistle. Since cancel-safe queues seem to be the way to go, are more of the sample drivers in the DDK going to be ported?
?
Chris
----- Original Message -----
From: Nar Ganapathy [MS]
Newsgroups: ntdev
To: NT Developers Interest List
Sent: Friday, June 21, 2002 12:24 PM
Subject: [ntdev] Re: Cancel-Safe Queues
?
Cancel safe queues are an API set that’s really a wrapper around your queue implementation but?abstracts the cancellation aspects of the design. For example you provide a callback routine to insert an IRP into a queue but call IoCsqInsertIrp to insert the IRP. By doing so, if the IRP is canceled the cancelation is handled automatically.?You don’t have to worry about handling all the various race conditions.
?
You can find more detailed documentation in the DDK and I believe NT Insider had an article on it as well. Its definitely worth moving to cancel safe queues because handling the cancellation races are hard to write and using cancel safe queues means you are already using tested code that’s being used by other drivers. For example the audio stack in XP uses the cancel safe queues.


posting is provided “AS IS” with no warranties, and confers no rights.
“Chris Dore” wrote in message news:xxxxx@ntdev…
Hi everyone,
?
I would just like to get some input on cancel-safe queues. Are they easier to implement than interlocked queues? Is it worth changing our existing queues to cancel-safe ones?
?
Any comments/suggestions welcome.
?
Thanks, Chris
?

You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to %%email.unsub%%

I hope more will be ported but right now the ones in the DDK are the examples we have.


This posting is provided “AS IS” with no warranties, and confers no rights.
“Chris Dore” wrote in message news:xxxxx@ntdev…
Does anyone know where I can find a cancel-safe queue implemented in a real driver. The cancel source in the DDK is ok but I’d just like to see if I can find another example to whet my whistle. Since cancel-safe queues seem to be the way to go, are more of the sample drivers in the DDK going to be ported?

Chris
----- Original Message -----
From: Nar Ganapathy [MS]
Newsgroups: ntdev
To: NT Developers Interest List
Sent: Friday, June 21, 2002 12:24 PM
Subject: [ntdev] Re: Cancel-Safe Queues

Cancel safe queues are an API set that’s really a wrapper around your queue implementation but abstracts the cancellation aspects of the design. For example you provide a callback routine to insert an IRP into a queue but call IoCsqInsertIrp to insert the IRP. By doing so, if the IRP is canceled the cancelation is handled automatically. You don’t have to worry about handling all the various race conditions.

You can find more detailed documentation in the DDK and I believe NT Insider had an article on it as well. Its definitely worth moving to cancel safe queues because handling the cancellation races are hard to write and using cancel safe queues means you are already using tested code that’s being used by other drivers. For example the audio stack in XP uses the cancel safe queues.


This posting is provided “AS IS” with no warranties, and confers no rights.
“Chris Dore” wrote in message news:xxxxx@ntdev…
Hi everyone,

I would just like to get some input on cancel-safe queues. Are they easier to implement than interlocked queues? Is it worth changing our existing queues to cancel-safe ones?

Any comments/suggestions welcome.

Thanks, Chris

The CD for the book “Programming the MS Windows Device Drivers” by
“Walter oney” has one such implementation called DEVQUEUE. You can find the
source for it in companion disk.

Cheers,

  • Jay

----- Original Message -----
From: Chris Dore
To: NT Developers Interest List
Sent: Friday, June 21, 2002 7:34 PM
Subject: [ntdev] Re: Cancel-Safe Queues

Does anyone know where I can find a cancel-safe queue implemented in a real driver. The cancel source in the DDK is ok but I’d just like to see if I can find another example to whet my whistle. Since cancel-safe queues seem to be the way to go, are more of the sample drivers in the DDK going to be ported?

Chris
----- Original Message -----
From: Nar Ganapathy [MS]
Newsgroups: ntdev
To: NT Developers Interest List
Sent: Friday, June 21, 2002 12:24 PM
Subject: [ntdev] Re: Cancel-Safe Queues

Cancel safe queues are an API set that’s really a wrapper around your queue implementation but abstracts the cancellation aspects of the design. For example you provide a callback routine to insert an IRP into a queue but call IoCsqInsertIrp to insert the IRP. By doing so, if the IRP is canceled the cancelation is handled automatically. You don’t have to worry about handling all the various race conditions.

You can find more detailed documentation in the DDK and I believe NT Insider had an article on it as well. Its definitely worth moving to cancel safe queues because handling the cancellation races are hard to write and using cancel safe queues means you are already using tested code that’s being used by other drivers. For example the audio stack in XP uses the cancel safe queues.


This posting is provided “AS IS” with no warranties, and confers no rights.
“Chris Dore” wrote in message news:xxxxx@ntdev…
Hi everyone,

I would just like to get some input on cancel-safe queues. Are they easier to implement than interlocked queues? Is it worth changing our existing queues to cancel-safe ones?

Any comments/suggestions welcome.

Thanks, Chris


You are currently subscribed to ntdev as: xxxxx@vsnl.net
To unsubscribe send a blank email to %%email.unsub%%