本文整理汇总了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');
}