8 File Storage
LOCK# file number [,wait variable]
The optional wait parameter indicates whether the computer should wait for access to the specified file while it is already locked via another task. If the value of the wait parameter is 0, the program will wait until the file is available (unlocked). If the wait parameter is not 0, the LOCK# statement will be aborted if the file is already locked. The default value is 0.
The value of the wait variable changes to 0 when the lock operation is successfully completed. If the lock operation is aborted, the wait variable changes to 1.
To release a data file for use by other tasks, use the UNLOCK# statement:
UNLOCK# file number