Console Lock

WIP
This commit is contained in:
Philipp Holzer 2019-08-13 21:20:41 +02:00
parent 425876316f
commit 41e2031e6b
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
9 changed files with 420 additions and 25 deletions

View file

@ -2,6 +2,8 @@
namespace Friendica\Core\Lock;
use Friendica\Core\Cache\Cache;
/**
* Class AbstractLock
*
@ -11,6 +13,9 @@ namespace Friendica\Core\Lock;
*/
abstract class Lock implements ILock
{
const TYPE_DATABASE = Cache::TYPE_DATABASE;
const TYPE_SEMAPHORE = 'semaphore';
/**
* @var array The local acquired locks
*/
@ -49,16 +54,14 @@ abstract class Lock implements ILock
}
/**
* Releases all lock that were set by us
*
* @return boolean Was the unlock of all locks successful?
* {@inheritDoc}
*/
public function releaseAll()
public function releaseAll($override = false)
{
$return = true;
foreach ($this->acquiredLocks as $acquiredLock => $hasLock) {
if (!$this->releaseLock($acquiredLock)) {
if (!$this->releaseLock($acquiredLock, $override)) {
$return = false;
}
}