[wdmaudiodev] Using KeAcquireInStackQueuedSpinLock

  • From: KS <wakeup1504@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Mon, 2 Mar 2009 12:09:18 +0800

Hi,

Does anyone have any experience in using KeAcquireInStackQueuedSpinLock. the
recommended way for getting spinlock for WinXP and above.

I'm trying to use this, and it seems that the call will always BSOD with the
following bugcheck code.

*** Fatal System Error: 0x0000007e
                       (0xC0000005,0x000CAD66,0x8336B6A4,0x8336B3A0)

Here's a short code extract of how I'm calling the function

...
KSPIN_LOCK mySpinLock;
KLOCK_QUEUE_HANDLE  LockHandle;
BOOL acquireAtDpc = FALSE;

 KeInitializeSpinLock(&mySpinLock);

if(KeGetCurrentIrql() == DISPATCH_LEVEL)
{
    KeAcquireInStackQueuedSpinLockAtDpcLevel(&mySpinLock, &LockHandle);
    acquireAtDpc = TRUE;
}
else
{
    KeAcquireInStackQueuedSpinLock(&mySpinLock, &LockHandle);
}

....
// Do the protected actions
...

if(acquireAtDpc)
{
    KeReleaseInStackQueuedSpinLockFromDpcLevel(&LockHandle);
}
else
{
    KeReleaseInStackQueuedSpinLock(&LockHandle);
}


Thanks for any advise on what I might be doing wrongly.

KS

Other related posts: