September 2001
Intermediate to advanced
768 pages
32h 45m
English
bool flock(resource file_handle, int operation)
Locks or releases a file.
Returns:
TRUE on success; FALSE on error
Description:
This function can put a lock on a file or release a previously established lock. Depending on the value of the operation, you have the following options:
| Operation | Action |
|---|---|
| 1 | Acquire a shared lock (reader) |
| 2 | Acquire an exclusive lock (writer) |
| 3 | Release a lock |
A shared lock is a so-called reader lock that should be used if you intend only to read from a file. This ensures that the file remains intact for reading while still allowing other processes to access the file.An exclusive lock is a writer lock that should be used if you intend to change a file. This type of lock prevents other processes from accessing ...
Read now
Unlock full access