|
|||||
|
||||||
Other Library Functions |
function |
vfsLock |
Library: File system utilities (OMVFS) legacy
Include: omvfs.xin |
define external function vfsLock value vfsFile file from value integer start optional to value integer end optional timeout value integer timeout optional id modifiable integer lock-id optional
Argument definitions
Use vfsLock to lock an entire vfsFile object or a specific area of it.
You must include the following line at the beginning of your OmniMark program:
include "omvfs.xin"
The vfsFile object file must be open (else external exception VFS200). The type of lock generated by this function depends on how file was opened. If file was opened with
The lock region begins at the start of the file if start is not specified. If start is specified it must be one of the following:
The lock region terminates at the end of the file if end is not specified. If end is specified it must have a value of either
The defined range for the lock must be at least one character long (else external exception VFS215). The range defined by start and end must not overlap any existing locks on the file (else external exception VFS216).
The timeout parameter allows you to specify the amount of time the program will wait for the specified lock to be completed before throwing an exception (external exception VFS217). If timeout is not specified, the function will wait until the lock is completed. If timeout is specified it must have a value of either:
lock-id is a modifiable parameter. If it is specified, the function will set it to a unique integer that identifies the newly locked region.
General OS operation failure exceptions will return external exception VFS300. The accompanying text will contain details on the reason for the exception.
Lock the region from byte 200 up to and including byte 400. Wait 2 seconds for the lock to be completed. Obtain an identifier for the lock.
include "omvfs.xin" process local vfsFile Frankfurt local integer Lock-ID . . . set Frankfurt to vfsOpen "myfile.txt" . . . vfsLock Frankfurt from 200 to 400 timeout 2000 id Lock-ID
Copyright © Stilo International plc, 1988-2008.