Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel eScript Language Reference > Siebel eScript Commands > The Clib Object >
Clib.flock() Method
This method locks or unlocks a file for simultaneous use by multiple processes.
Syntax
Clib.flock(filePointer, mode)
Parameter Description filePointer A file pointer as returned by Clib.fopen() or Clib.tmpfile() mode One of the following:Returns
0 if successful; otherwise, a nonzero integer.
Usage
The flock() function applies or removes an advisory lock on the file identified by filePointer. Advisory locks allow cooperating processes to perform consistent operations on files. However, other processes may still access the files, which can cause inconsistencies.
The locking mechanism allows two types of locks: shared and exclusive. Multiple processes can have shared locks on a file at the same time; however, there cannot be multiple exclusive locks, or shared locks and an exclusive lock, on one file at the same time.
Read permission is required on a file to obtain a shared lock, and write permission is required to obtain an exclusive lock. Locking a segment that is already locked by the calling process causes the old lock type to be removed and the new lock type to take effect.
If a process requests a lock on an object that is already locked, the request is locked until the file is freed, unless LOCK_NB is used. If LOCK_NB is used, the call fails and the error EWOULDBLOCK is returned.
NOTE: Clib.flock() is not supported in Unicode builds. It always returns 0.
Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel eScript Language Reference Published: 18 April 2003 |