FileTools[IsLockable] - check to see if a file lock is obtainable
|
Calling Sequence
|
|
IsLockable(file, opt1, opt2, ...)
|
|
Parameters
|
|
file
|
-
|
filename or the file descriptor of an open file
|
opt1, opt2, ...
|
-
|
(optional) arguments
|
|
|
|
|
Description
|
|
•
|
The IsLockable(file) command checks if it is currently possible to obtain a file lock for file. With no optional arguments, an exclusive lock for the entire file is tested.
|
•
|
The IsLockable function returns true if the lock can be obtained and false otherwise. If an error occurs, an exception is raised.
|
•
|
If opt1, opt2, ... is bytes=low..high, then the bytes in file position low to high in file are locked. If relative is also specified then low and high are considered relative to the current file position. It is possible to lock regions beyond the end of the file using the bytes argument.
|
•
|
Some implementations of IsLockable will temporarily obtain the file lock. Therefore, during a call to IsLockable other processes may see the file as locked.
|
•
|
Using IsLockable to determine when Lock must be called is not safe. It is possible for another process to acquire a lock on the file between the call to IsLockable and Lock. Instead, Lock must be called and the false return handled appropriately.
|
•
|
For more information about Maple file locking capabilities, see the Lock help page.
|
•
|
IsLockable supports the type=shared argument on those operating systems that support it. The block argument is not a valid argument to IsLockable.
|
|
|
Download Help Document
Was this information helpful?