basic.lock Statement/BASIC Program

basic.lock

Command basic.lock Statement/BASIC Program
Applicable release versions: R83, AP
Category BASIC Program (486)
Description sets one of 64 "execution" locks, in the range 0 to 63. This prevents program "re-entrancy", allowing only one process to run the program at any given time.

If the specified lock is found "unlocked", this statement "locks" the lock and the "then" clause, if present, is executed. If the lock is already locked by another process or by the current process at a different level, it remains locked and the "else" clause, if present, is executed. If the lock is locked by another process or by the current process at a different level and no "else" clause is used, the program waits until the lock is unlocked.

If the "lock.number" expression evaluates to greater than 63, the result is divided by 64, and the "lock.number" is equal to the remainder of the equation.

See the "then/else construct" for an explanation on the use of "then" and "else" clauses in statements that allow or require them.
Syntax lock lock.number {then | else statement.block}
Options
Example
lock 12

This unconditionally sets execution lock 12.

lock 14 else crt "Program is locked" ; stop

This attempts to set lock 14. If it is already locked, the program advises the 
operator and stops.
Purpose
Related basic.statements
basic.unlock
tcl.unlock-item
basic.then/else.construct
basic.then
statement.block
tcl.clear-basic-locks
tcl.clear-locks
ue.0191
ue.2191
ue.1191
ue.3191
tcl.list-locks_rp
tcl.unlock-file