本文整理匯總了PHP中Lock::off方法的典型用法代碼示例。如果您正苦於以下問題:PHP Lock::off方法的具體用法?PHP Lock::off怎麽用?PHP Lock::off使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Lock
的用法示例。
在下文中一共展示了Lock::off方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __call
function __call($fnName, $args)
{
if (in_array($fnName, self::$functionExceptions)) {
return call_user_func_array(array($this, $fnName), $args);
}
//get node (since all private functions require it)
$node = $args[0] = $this->getNode($args[0]);
if ($this->fkColumn) {
$this->baseWhere[$this->fkColumn] = $node[$this->fkColumn];
}
//get foreign key to localise lock
$lockName = 'DbTree-' . $this->table;
if ($this->fkColumn) {
$lockName .= '-' . $node[$this->fkColumn];
}
$this->__methodExists($fnName);
Lock::req($lockName, 2);
$this->db->db->beginTransaction();
try {
$return = call_user_func_array(array($this, $fnName), $args);
$this->db->db->commit();
} catch (Exception $e) {
Lock::off($lockName);
$this->db->db->rollBack();
throw $e;
}
Lock::off($lockName);
return $return;
}
示例2: stop
static function stop()
{
Debug::out('Stopping');
//set lock to tell existing cron to turn off
if (!Lock::on('cron-off-' . $_ENV['projectName'])) {
Debug::quit('Lock off failed');
}
echo "\n";
//wait for exist cron to turn off
while (Lock::isOn('cron-running-' . $_ENV['projectName'])) {
echo '.';
sleep(1);
}
//remove lock off
Lock::off('cron-off-' . $_ENV['projectName']);
Debug::out('Stopped');
}