Re: Never seen a driver that uses a KSEMAPHORE ???
- From: 0dbell@xxxxxxxxx
- Date: Wed, 20 Feb 2008 06:01:12 -0800 (PST)
On Feb 20, 8:21 am, "Maxim S. Shatskih" <ma...@xxxxxxxxxxxxxxxx>
wrote:
My understanding is that this is the only available synchronization
mechanism to handle serialized access to a cancel-safe IRP queue.
I think that these queues are usually protected by spinlock.
Indeed, this is what I am using in the CsqAcquireLock and the
CsqReleaseLock routines themselves.
However, the semaphore is **in addition** to the spinlock and is
intended to let the waiting thread track the number of IRPs in the
queue. I did not invent this - this is the exact method depicted in
the CSQ sample that comes with WDK.
CancelRoutine can be fired on DISPATCH_LEVEL, which makes any sync
objects other then spinlocks unusable in this context.
That semaphore, both in my driver and in the cancel.c sample, is:
1. Being WaitedFor in a system thread only.
2. KeReleaseSemaphore in dispatch routines only (always called at
PASSIVE_LEVEL, right? despite the confusing naming...)
3. KeInitializeSemaphore in a DRIVER_ADD_DEVICE routine (always
called at
PASSIVE_LEVEL).
Can't go wrong with that, right?
Thanks,
Don
.
- References:
- Never seen a driver that uses a KSEMAPHORE ???
- From: 0dbell
- Re: Never seen a driver that uses a KSEMAPHORE ???
- From: Walter Oney
- Re: Never seen a driver that uses a KSEMAPHORE ???
- From: 0dbell
- Re: Never seen a driver that uses a KSEMAPHORE ???
- From: Maxim S. Shatskih
- Never seen a driver that uses a KSEMAPHORE ???
- Prev by Date: Re: Never seen a driver that uses a KSEMAPHORE ???
- Next by Date: WDF - how to share interrupt between two driver those are in the same stack?
- Previous by thread: Re: Never seen a driver that uses a KSEMAPHORE ???
- Next by thread: NDIS - crash in NETIO.SYS after NdisMSendNetBufferListsComplete
- Index(es):
Relevant Pages
|