LOCK


The LOCK statement will attempt to set an execution lock thus preventing any other jBC program that respects that lock to wait until this program has released it.

 

COMMAND SYNTAX

LOCK expression {THEN|ELSE statements}

 

SYNTAX ELEMENTS

The expression should evaluate to a numeric value between 0 and 255 (63 in R83 import mode).

The statement will execute the THEN clause (if defined) providing the lock could be taken. If the LOCK is already held by another program and an ELSE clause was provided then the statements defined by the ELSE clause are executed. If no ELSE clause was provided with the statement then it will block (hang) until the lock has been released by the other program.

 

NOTES

See also UNLOCK.

If the program was compiled with the environment variable JBCEMULATE set to r83, the number of execution locks is limited to 64. If an execution lock greater than this number is specified, the actual lock taken is the specified number modulo 64.

Warning! Issuing a RELEASE statement with no arguments will release all execution locks that were set in the current program.

 

EXAMPLE

LOCK 32 ELSE
   CRT "This program is already executing!"
STOP
END


jBC