These calls provide blocking, advisory read and/or write locks for data
synchronization. A read lock permits additional read locks but not a
write lock. A write lock prohibits any additional locks from being applied.
Locking calls will block until the lock can be applied. Locks apply to
the entire file.
LockPread
applies a read lock on the given file and returns a file handle for use
by LockVread. If a write lock exists on the file, the call
does not return until the lock has been released and the requested
lock is set.
LockVread
releases the read lock corresponding to the given file handle.
LockPwrite
applies a write lock on the given file and returns a file handle for use
by LockVwrite. If a read or write lock exists on the
file, the call does not return until the lock has been released
and the requested lock is set.
LockVwrite
releases the write lock corresponding to the given file handle.
Arguments
filename
full pathname of a filesystem object (file, directory etc.)
filehandle
lock file handle returned by LockPread orLockPwrite.
Return values
LockPread and LockPwrite return a
lock file handle for use with subsequent
LockVread or LockVwrite
calls. Note, this is not a generic Tcl file handle
that may be used with generic IO functions;
it is internal to the lock subsystem.
Diagnostics
Errors encountered (such as non-existent file, wrong permissions) will result
in a throw with a SCOadmin error stack. See
Error(3tlib)
or
catch(1tcl).