UNLOCK Statement

The UNLOCK statement relinquishes an acquired interlock.

<unlock statement>

── UNLOCK ─┬────────────┬─<interlock designator>───────────────────────┤
           └─ [STRICT] ─┘

The UNLOCK statement is used to relinquish an interlock that was previously acquired by a LOCK interlock statement. UNLOCK can be used as a function. If UNLOCK is used as a statement, the process is discontinued when the result is a value other than 1 (successfully unlocked).

The UNLOCK function is of the type INTEGER, and the following values can be returned:

Note: If the caller does not own the interlock and the STRICT option is used, a result of 6 is returned.

Value

Meaning

1

The interlock was successfully unlocked.

6

The caller does not allow the interlock.

The following conditions cause various values to be returned:

  • If the interlock is FREE, the state is not changed, and a result of 6 is returned.

  • If the interlock is LOCKED_UNCONTENDED when this operation is performed, the state is changed to FREE, and a result of 1 is returned.

  • If the interlock is LOCKED_CONTENDED, a result of 1 is returned, and the interlock is given to the first contended process in the contender list. If only one contender is in the list, the state is changed to LOCKED_UNCONTENDED; otherwise it is not changed.