Inheritance: implements Jamm\Memory\IKeyLocker
Exemplo n.º 1
0
 /**
  * Unlock key, locked by method 'lock_key'
  * @param \Jamm\Memory\KeyAutoUnlocker $key_auto_unlocker
  * @return bool
  */
 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;
 }
Exemplo n.º 2
0
 /**
  * Unlock key, locked by method 'lock_key'
  * @param \Jamm\Memory\KeyAutoUnlocker $auto_unlocker
  * @return bool
  */
 public function unlock_key(\Jamm\Memory\KeyAutoUnlocker $auto_unlocker)
 {
     $key = $auto_unlocker->getKey();
     if (empty($key)) {
         $this->ReportError('Empty key in the AutoUnlocker', __LINE__);
         return false;
     }
     $auto_unlocker->revoke();
     return $this->mem_object->del(self::lock_key_prefix . $key);
 }