| 1 | <?php |
||
| 8 | class LockAdapterMutex implements MutexInterface |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var LockAdapterInterface |
||
| 12 | */ |
||
| 13 | private $lockAdapter; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | private $resourceName; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var bool |
||
| 22 | */ |
||
| 23 | private $acquired = false; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param LockAdapterInterface $lockAdapter |
||
| 27 | * @param string $resourceName |
||
| 28 | */ |
||
| 29 | public function __construct(LockAdapterInterface $lockAdapter, $resourceName) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @see \MetaborStd\Semaphore\MutexInterface::releaseLock() |
||
| 37 | */ |
||
| 38 | public function releaseLock() |
||
| 51 | |||
| 52 | /** |
||
| 53 | * @see \MetaborStd\Semaphore\MutexInterface::isAcquired() |
||
| 54 | */ |
||
| 55 | public function isAcquired() |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @see \MetaborStd\Semaphore\MutexInterface::acquireLock() |
||
| 62 | */ |
||
| 63 | public function acquireLock() |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @see \MetaborStd\Semaphore\MutexInterface::isLocked() |
||
| 74 | */ |
||
| 75 | public function isLocked() |
||
| 79 | |||
| 80 | /** |
||
| 81 | * release lock if mutex instance is destroyed. |
||
| 82 | */ |
||
| 83 | public function __destruct() |
||
| 87 | } |
||
| 88 |