class flock
File locking class
Methods
__construct($path)
Constructor. |
||
acquire()
Tries to acquire the lock. |
||
owns_lock()
Does this process own the lock? |
||
null |
release()
Releases the lock. |
Details
at line 41
public
__construct($path)
Constructor.
You have to call acquire() to actually acquire the lock.
at line 65
public
acquire()
Tries to acquire the lock.
If the lock is already held by another process, this call will block until the other process releases the lock. If a lock is acquired and is not released before script finishes but the process continues to live (apache/fastcgi) then subsequent processes trying to acquire the same lock will be blocked forever.
If the lock is already held by the same process via another instance of this class, this call will block forever.
If flock function is disabled in php or fails to work, lock acquisition will fail and false will be returned.
at line 116
public
owns_lock()
Does this process own the lock?
at line 132
public null
release()
Releases the lock.
The lock must have been previously obtained, that is, acquire() call was issued and returned true.
Note: Attempting to release a lock that is already released, that is, calling release() multiple times, is harmless.