Guardian Procedure Calls Reference Manual (G06.25+)
Guardian Procedure Calls (L)
Guardian Procedure Calls Reference Manual—522629-013
8-13
LOCKFILE Procedure
•
Alternate mode
If the file is already locked by another user when the call to LOCKFILE is
made, the lock request is rejected, and the call to LOCKFILE completes
immediately with error 73 (“file is locked”). The alternate locking mode is
specified by calling the SETMODE procedure and specifying function 4.
•
Locks and open files—applies to non-audited files only
Locks are granted on an open file (that is, file number) basis. Therefore, if a
process has multiple opens of the same file, a lock of one file number excludes
access to the file through other file numbers.
•
Attempting to read a locked file in default locking mode
If the default locking mode is in effect when a call to READ or READUPDATE is
made to a file which is locked by another user, the caller of READ or
READUPDATE is suspended and queued in the “locking” queue behind other
users attempting to access the file.
•
Accessing a locked file
If the file is locked by a user other than the caller at the time of the call, the call is
rejected with file-system error 73 (“file is locked”) when:
•
READ or READUPDATE is called, and the alternate locking mode is in effect.
•
WRITE, WRITEUPDATE, or CONTROL is called.
•
A count of the locks in effect is not maintained. Multiple locks can be unlocked with
one call to UNLOCKFILE. For example:
.
CALL LOCKFILE ( FILE^A,...); ! FILE^A becomes locked.
.
CALL LOCKFILE ( FILE^A,...); ! is a null operation,
! because the file is
! already locked.
1 A condition code
! of CCE returns.
.
CALL UNLOCKFILE ( FILE^A,...); ! FILE^A becomes
unlocked.
.
CALL UNLOCKFILE ( FILE^A,...); ! is a null operation,
! because the file is
! already unlocked.
! A condition code of
! CCE returns.
Note. For non-audited files, a deadlock condition—a permanent suspension of your
application—occurs if READ or READUPDATE is called by the process which has a record
locked by a filenum other than that supplied in READ or READUPDATE. (Refer to the
FILE_OPEN_ procedure for an explanation of multiple opens by the same process.)