public function lock_key($key, &$auto_unlocker_variable)
{
$auto_unlocker = NULL;
if (!$this->sem->get_access_write($auto_unlocker)) {
return false;
}
$this->readmemory();
$key = (string) $key;
if (isset($this->mem[self::map_key_locks][$key])) {
return false;
}
$this->mem[self::map_key_locks][$key] = 1;
if ($this->refresh()) {
$auto_unlocker_variable = new \Jamm\Memory\KeyAutoUnlocker(array($this, 'unlock_key'));
$auto_unlocker_variable->setKey($key);
return true;
} else {
return false;
}
}