basic.lock
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
User Comments
What do you think?
Share your experience or ask a question by using the form below.
Login to leave your comments.
