Jamm\Memory\Shm\SingleMemory::unlock_key PHP 메소드

unlock_key() 공개 메소드

Unlock key, locked by method 'lock_key'
public unlock_key ( KeyAutoUnlocker $key_auto_unlocker ) : boolean
$key_auto_unlocker Jamm\Memory\KeyAutoUnlocker
리턴 boolean
    public function unlock_key(\Jamm\Memory\KeyAutoUnlocker $key_auto_unlocker)
    {
        $key = $key_auto_unlocker->getKey();
        if (empty($key)) {
            $this->ReportError('Empty key in the AutoUnlocker', __LINE__);
            return false;
        }
        $key_auto_unlocker->revoke();
        if (!$this->sem->get_access_write($auto_unlocker)) {
            return false;
        }
        $this->readmemory();
        if (!isset($this->mem[self::map_keys][$key])) {
            $this->ReportError('key [' . $key . '] does not exists', __LINE__);
            return false;
        }
        if (isset($this->mem[self::map_key_locks][$key])) {
            unset($this->mem[self::map_key_locks][$key]);
            return $this->refresh();
        }
        return true;
    }