Using Spin Locks

Code that references the same objects that the driver's deferred procedure call (DPC) function references must be synchronized to avoid simultaneous attempts at referencing the same object. Drivers can acquire a spin lock at a specified IRQL in order to prevent other processors, or other code running at a lower IRQL, from simultaneously referencing an object. To synchronize access to objects referenced by a DPC function, the spin lock is obtained at an IRQL of DISPATCH_LEVEL.

Spin locks are used within soundlib.lib.

The Kernel-Mode Drivers Design Guide provides an extensive discussion of spin locks.