Specifications
System Macros Invoked by Drivers
UNLOCK
UNLOCK
Relinquishes synchronized access to a system resource as appropriate to the
processing environment.
Format
UNLOCK lockname [,newipl] [,condition] [,preserve=YES]
Parameters
lockname
Name of the system resource to be released or restored.
[newipl]
Location containing the IPL to which to lower. A prior invocation of the LOCK
macro may have stored this IPL value.
[condition]
Indication of a special use of the macro. The only defined condition is
RESTORE, which causes the macro—in a multiprocessing environment—to call
SMP$RESTORE instead of SMP$RELEASE, thus releasing a single acquisition
of the spinlock by the local processor.
[preserve=YES]
Indication that the macro should preserve R0 across an invocation. If you do not
need to retain the contents of R0, specifying preserve=NO can enhance system
performance.
Description
In a uniprocessing environment, the UNLOCK macro lowers IPL to newipl.Ifan
interrupt is pending at the current IPL or at any IPL above newipl, the current
procedure is immediately interrupted.
In a multiprocessing environment, the UNLOCK macro performs the following
tasks:
• Preserves R0 through the macro call (if preserve=YES is specified).
• Generates a spinlock index of the format SPL$C_lockname and stores it in
R0.
• Calls SMP$RELEASE or, if condition=RESTORE is specified,
SMP$RESTORE. These routines index into the system spinlock database
(a pointer to which is located at SMP$AR_SPNLKVEC) to release the
appropriate spinlock.
• Moves any specified newipl into the local processor’s IPL register (PR$_IPL).
If an interrupt is pending at the current IPL or at any IPL above newipl, the
current procedure is immediately interrupted.
In either processing environment, the UNLOCK macro sets the SMP-modified bit
in the driver prologue table (DPT$V_SMPMOD in DPT$L_FLAGS).
2–101