Re: [NTDEV] Spinlocks in NDIS Drivers

> I was just thinking that what will actually happen if the same thread

tries to acquire the spin lock twice.???

On MP kernel - deadlock with the CPU hung forever.
On UP one - nothing serious.

Can the spinlock be acquired twice
by tha same thread.

No. It cannot be acquired twice regardless of whether this is the same
thread
or not, the same CPU or not.

spinlock twice but in huge bulcky codes it could be a possibility that the
same spin lock may be acuired twice.

This must be avoided. Never do anything non-trivial while holding a
spinlock.

In case of two threads trying to acquire the spin lock One thread will
wait
if the spinlock is already acquired by other thread. But what will happen

More correct is - two CPUs, not two threads. Spinlocks can be acquired
by things like DPCs which are not threads.
And it is CPU which waits on the spinlock, not thread.

Max