PHP 클래스 malkusch\lock\mutex\Mutex

저자: Markus Malkusch ([email protected])
파일 보기 프로젝트 열기: malkusch/lock

공개 메소드들

메소드 설명
check ( callable $check ) : DoubleCheckedLocking Performs a double-checked locking pattern.
synchronized ( callable $code ) : mixed Executes a block of code exclusively.

메소드 상세

check() 공개 메소드

Call {@link DoubleCheckedLocking::then()} on the returned object. Example: $mutex->check(function () use ($bankAccount, $amount) { return $bankAccount->getBalance() >= $amount; })->then(function () use ($bankAccount, $amount) { $bankAccount->withdraw($amount); });
public check ( callable $check ) : DoubleCheckedLocking
$check callable
리턴 malkusch\lock\util\DoubleCheckedLocking The double-checked locking pattern.

synchronized() 추상적인 공개 메소드

This method implements Java's synchronized semantic. I.e. this method waits until a lock could be acquired, executes the code exclusively and releases the lock. The code block may throw an exception. In this case the lock will be released as well.
abstract public synchronized ( callable $code ) : mixed
$code callable The synchronized execution block.
리턴 mixed The return value of the execution block.