B.3.3 Dynix/PTX Spin Lock Primitives
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):
·init_lock
·p_lock
·v_lock
These primitives are implemented as macros that call the kernel-mode spin lock functions.
init_lock
The init_lock function initializes a spin lock.
VOID
init_lock(
IN lock_t *lockp
);
Parameters
lockp
Points to the spin lock to be initialized.
p_lock
The p_lock function acquires a spin lock and returns the previous IRQL.
INT
p_lock(
IN lock_t *lockp,
IN INT ignored
);
Parameters
lockp
Points to the spin lock to be acquired.
ignored
Ignored for Windows NT.
v_lock
The v_lock function releases a spin lock.
VOID
v_lock(
IN lock_t *lockp,
IN USHORT level
);
Parameters
lockp
Points to the spin lock to be released.
level
Specifies the IRQL to restore.