|Bookshelf Home | Contents | Index | PDF|
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.
|Siebel eScript Language Reference|