Stackable::synchronized
Synchronization
&reftitle.description;
final public mixedStackable::synchronized
Closureblock
mixed...
Executes the block while retaining the synchronization lock for the current context.
&reftitle.parameters;
block
The block of code to execute
...
Variable length list of arguments to use as function arguments to the block
&reftitle.returnvalues;
The return value from the block
&reftitle.examples;
Synchronizing
synchronized(function($object){
var_dump($object->isWaiting());
$object->notify();
}, $this);
}
}
/** create worker **/
$my = new My();
/** stack my **/
/** execute something here **/
$my->synchronized(function($object){
$object->wait();
}, $my);
?>
]]>
&example.outputs;