PHP - Mutex::trylock() Function
Mutex::trylock() function can attempt to acquire the Mutex.
Syntax
final public static boolean Mutex::trylock( long $mutex )
Mutex::trylock() function can attempt to lock the Mutex for a caller without blocking if the Mutex is owned (locked) by another Thread.
Mutex::trylock() function can return a boolean indication of success.
Example
<?php $mutex = Mutex::create(); var_dump(Mutex::trylock($mutex)); var_dump(Mutex::unlock($mutex)); Mutex::destroy($mutex); ?>
php_function_reference.htm
Advertisements