Method | Description | |
---|---|---|
check ( callable $check ) : |
Performs a double-checked locking pattern. | |
synchronized ( callable $code ) : mixed | Executes a block of code exclusively. |
$mutex->check(function () use ($bankAccount, $amount) {
return $bankAccount->getBalance() >= $amount;
})->then(function () use ($bankAccount, $amount) {
$bankAccount->withdraw($amount);
});
abstract public synchronized ( callable $code ) : mixed | ||
$code | callable | The synchronized execution block. |
return | mixed | The return value of the execution block. |