In Windows NT, the thread that acquires a spin lock must release the lock. Another thread cannot release the spin lock on behalf of the first thread. Variables of type lock_t should only be accessed by the following Dynix/PTX spin lock primitives (Further Readings on Streams, Reference 3):
These primitives are implemented as macros that call the kernel-mode spin lock functions.
The init_lock function initializes a spin lock.
VOID init_lock( IN lock_t *lockp );
The p_lock function acquires a spin lock and returns the previous IRQL.
INT p_lock( IN lock_t *lockp, IN INT ignored );
The v_lock function releases a spin lock.
VOID v_lock( IN lock_t *lockp, IN USHORT level );