In-Stack queued spin lock & NDIS

Hi,

As we all now, we can use in our code both ‘Spin lock’ and ‘In-Stack queued
spin lock’ in our code using
KeAcquireSpinLock() & KeAcquireInStackQueuedSpinLock() API functions
correspondingly.

When we write code in NDIS environment we use ‘NDIS spin lock’ and use
NdisAcquireSpinLock() API

I didn’t find any documentation regarding ‘In-Stack queued spin lock’ in
NDIS.

  1. Is there something like this in NDIS?
  2. Are there any plans to add such implementation?

Thanks!

  1. there does not appear to be an equivalent
  2. I don’t think so, but that shouldn’t stop you from using the WDM in stack queued spinlock though. Remember though that the KLOCK_QUEUE_HANDLE must be a unique address per thread which is attempting to acquire the lock, e.g. a value on the stack. This means that you cannot put a KLOCK_QUEUE_HANDLE into a common structure that more then one thread will use to acquire the lock, essentially the pattern of putting the spinlock and the IRQL into a NDIS_SPIN_LOCK that everybody uses cannot be used for the an instack queued spin lock (hence the “in stack” part of the name)

d

Hi Doron,

I do aware to the unique thread address/NOT use the common structure - I already been hit from that mistake some years ago.
I just thought that the NDIS_SPIN_LOCK might have the advanced in-stack as well.

Thanks anyway