dont release shared lock if we dont have any

This commit is contained in:
Robin Appelman 2015-05-20 16:25:41 +02:00
parent f0b8672729
commit 006eaa84aa
1 changed files with 4 additions and 2 deletions

View File

@ -88,8 +88,10 @@ class MemcacheLockingProvider implements ILockingProvider {
*/
public function releaseLock($path, $type) {
if ($type === self::LOCK_SHARED) {
$this->memcache->dec($path);
$this->acquiredLocks['shared'][$path]--;
if (isset($this->acquiredLocks['shared'][$path]) and $this->acquiredLocks['shared'][$path] > 0) {
$this->memcache->dec($path);
$this->acquiredLocks['shared'][$path]--;
}
} else if ($type === self::LOCK_EXCLUSIVE) {
$this->memcache->cas($path, 'exclusive', 0);
unset($this->acquiredLocks['exclusive'][$path]);