|
eZ Publish
[4.2]
|
The class eZMutex provides a file based mutex. The mutex works across processes. More...
Public Member Functions | |
| clearMeta () | |
| eZMutex ($name) | |
| lock () | |
| lockTS () | |
| meta ($key) | |
| setMeta ($key, $value) | |
| steal ($force=false) | |
| test () | |
| unlock () | |
Public Attributes | |
| $FileName | |
| $Name | |
| const | STEAL_STRING = '_eZMutex_Steal' |
Private Member Functions | |
| fp () | |
The class eZMutex provides a file based mutex. The mutex works across processes.
Definition at line 40 of file ezmutex.php.
| eZMutex::clearMeta | ( | ) |
| eZMutex::eZMutex | ( | $ | name | ) |
Constructor. Creates a mutex object for mutext <name>. The mutex is file based, and a mutex is valid across PHP processes.
| mutex | name |
Definition at line 51 of file ezmutex.php.
Referenced by steal().
| eZMutex::fp | ( | ) | [private] |
Get file pointer
Definition at line 67 of file ezmutex.php.
| eZMutex::lock | ( | ) |
Lock. Blocks untill the mutex becomes available
Definition at line 105 of file ezmutex.php.
Referenced by steal().
| eZMutex::lockTS | ( | ) |
Get the timestamp of when the mutex was locked
Definition at line 189 of file ezmutex.php.
| eZMutex::meta | ( | $ | key | ) |
Read meta data
| key |
Definition at line 145 of file ezmutex.php.
Referenced by lockTS().
| eZMutex::setMeta | ( | $ | key, |
| $ | value | ||
| ) |
Set metadata
| key | |
| value |
Definition at line 125 of file ezmutex.php.
Referenced by lock().
| eZMutex::steal | ( | $ | force = false | ) |
Steal. The function will aquire a lock on the mutex when it's stolen. $myMutex = new eZMutex( 'myMutex' ); if ( $myMutex->steal() ) { protected code goes here $myMutex->unlock(); }
| force. | If this is set to true, the process will steal the mutex, even if other processes are in the process of stealing it as well. |
Definition at line 211 of file ezmutex.php.
| eZMutex::test | ( | ) |
Test if mutex is locked.
Definition at line 86 of file ezmutex.php.
Referenced by lockTS().
| eZMutex::unlock | ( | ) |
Unlock. Unlocks the mutex.
Definition at line 171 of file ezmutex.php.
Referenced by steal().
| eZMutex::$FileName |
Definition at line 253 of file ezmutex.php.
| eZMutex::$Name |
Definition at line 252 of file ezmutex.php.
| const eZMutex::STEAL_STRING = '_eZMutex_Steal' |
Definition at line 42 of file ezmutex.php.
Referenced by steal().