Portable advisory file locking
flock ( resource $handle , int $operation [, int &$wouldblock ] ) : bool
A file system pointer resource that is typically created using fopen().
|LOCK_SH||acquire a shared lock (reader)|
|LOCK_EX||acquire an exclusive lock (writer)|
|LOCK_UN||release a lock (shared or exclusive)|
|LOCK_NB||add as a bitmask to one of the above operations if you don't want flock() to block while locking|
The optional third argument is set to 1 if the lock would block (EWOULDBLOCK errno condition).
Returns TRUE on success or FALSE on failure.
HANDLE OPERATION | LOCK_SH
HANDLE OPERATION | LOCK_EX
HANDLE OPERATION | LOCK_NB