basic.lock

Statement/BASIC Program, Releases: R83 and AP

Sets execution lock.

Syntax

lock lock.number {then | else statement.block}

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.

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.

See Also

Command Name Type Description
basic.statements Definition Definition of statements and functions.
basic.unlock Statement Resets execution lock.
tcl.unlock-item Verb: Access Clears item locks in specified file.
basic.then/else.construct Definition provide program flow change based upon a boolean condition.
basic.then Statement In-line initiator.
statement.block Definition one or more statements that follow a Pick/BASIC decision-path related token such as, but not limited to, 'then', 'else', 'locked' and 'onerr'.
tcl.clear-basic-locks Verb: Access Invokes command: 'clear-locks (b'.
tcl.clear-locks Verb: Access Clears locks.
ue.0191 User Exit Sets execution lock number 9.
ue.2191 User Exit Unconditionally releases execution lock number 9.
ue.1191 User Exit Releases execution lock number 9.
ue.3191 User Exit Releases an execution lock if it was locked by this port.number.
tcl.list-locks_rp Verb: Access Displays status of all locks.
tcl.unlock-file Verb: Access Clears a file lock on a specified file.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.