Use this system macro to reserve access to (or lock) a resource and prevent
access to it by other I-streams. If the resource is already locked by
another I-stream, the I-stream attempting the lock will spin (that
is, loop in place) waiting for the lock to be freed. When the lock is
freed, this macro locks the resource. If the spin lasts too long, the
macro times out and a system error is issued.
Format
- label
- A symbolic name can be assigned to the macro statement.
- IMMED=program_name
- Optional. If coded, it is the name of a routine to be given control
if the lock is already held by another I-stream. This is in lieu of the
spin lock.
- LKWORD=field
- The name of a doubleword field to be used for lock and trace
functions.
- TRACE=YES|NO
- Specify one of the following:
- YES
- The current address will be placed in the second fullword of the LKWORD
field.
- NO
- The trace function is skipped.
- WKREG
- The specified register is used as a work register by the macro.
Entry Requirements
None.
Return Conditions
- Control is returned to the next sequential instruction.
- The contents of the work register specified is unknown. The
contents of all other registers are preserved across this macro call.
Programming Considerations
- This macro can be run on any I-stream.
- Return is made to the next sequential instruction.
- The lock specified by LKWORD must not be held by this I-stream. If
the lock is held a system error will be taken and the lock will be
held.
- The protection key of the program issuing the $LOCKC macro must be the
same as the item being locked.
- No other lock should be held by this I-stream since a lock-out
condition could occur.
- If several I-streams are waiting for the same lock, it is unpredictable
which I-stream will obtain the lock when it is freed, regardless of which
I-stream began waiting first.
- A catastrophic system error will occur if the spin lock (IMMED is not
coded) times out.
Examples
None.