unlock_unlock_a_locked_data_file_.htm
Navigation: Language Reference > 13 - Built-in Functions >====== UNLOCK (unlock a locked data file) ====== | |
UNLOCK(file)
UNLOCK | Unlocks a previously locked data file. |
file | The label of a FILE declaration. |
The UNLOCK statement unlocks a previously LOCKed data file. It will not unlock a file locked by another user. If the file is not locked, or is locked by another user, UNLOCK is ignored. UNLOCK posts no errors.
Example:
LOOP !Loop to avoid “deadly embrace”
LOCK(Master,1) !Lock the master file, try for 1 second
IF ERRORCODE() = 32 !If someone else has it
CYCLE !try again
END
LOCK(Detail,1) !Lock the detail file, try for 1 second
IF ERRORCODE() = 32 !If someone else has it
UNLOCK(Master) !unlock the locked file
CYCLE !try again
END
BREAK !Break loop when both files are locked
END
See Also:
unlock_unlock_a_locked_data_file_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1