Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions src/Mutex.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,30 +82,6 @@ public function releaseLock()
return false;
}

/**
* Try to release any obtained locks when object is destroyed
*
* This is a safe guard for cases when your php script dies unexpectedly.
* It's not guaranteed it will work either.
*
* You should not depend on __destruct() to release your locks,
* instead release them with `$released = $this->releaseLock()`A
* and check `$released` if lock was properly released
* @throws UnrecoverableMutexException
*/
public function __destruct()
{
while ($this->isAcquired()) {
$released = $this->releaseLock();
if (!$released) {
throw new UnrecoverableMutexException(sprintf(
'Cannot release lock in Mutex __destruct(): %s',
$this->name
));
}
}
}

/**
* Check if Mutex is acquired
*
Expand Down