Method
Claim::release
Give the claim up, so that another can take it.
Description#
public Claim::release(): voidDoes nothing when this handle holds nothing.
Examples#
use Swerve\Swerve;
phasync::run(function () {
$claim = Swerve::claim('leader');
$claim->acquire();
echo 'held: ', var_export($claim->held(), true), "\n";
$claim->release(); // give it up while the handle lives on
echo 'held: ', var_export($claim->held(), true), "\n";
echo 'available: ', var_export($claim->available(), true), "\n";
$claim->release(); // releasing what is not held does nothing
});Output
held: true held: false available: true
See also#
Claim::acquireTake the name, trying every 20 ms for up to$timeoutseconds when another holds it.