mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 11:44:10 +09:00
#17893298 : added DB based lock (using unique key)
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6000 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
fb18db9528
commit
ea7c87ec0d
5 changed files with 60 additions and 0 deletions
|
|
@ -646,5 +646,33 @@
|
|||
$args->module_filebox_srl = $vars->module_filebox_srl;
|
||||
return executeQuery('module.deleteModuleFileBox', $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief function of locking (timeout is in seconds)
|
||||
*/
|
||||
function lock($lock_name, $timeout, $member_srl = null) {
|
||||
$this->unlockTimeoutPassed();
|
||||
$args->lock_name = $lock_name;
|
||||
if(!$timeout) $timeout = 60;
|
||||
$args->deadline = date("YmdHis", time() + $timeout);
|
||||
if($member_srl) $args->member_srl = $member_srl;
|
||||
$output = executeQuery('module.insertLock', $args);
|
||||
if($output->toBool()) {
|
||||
$output->add('lock_name', $lock_name);
|
||||
$output->add('deadline', $args->deadline);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function unlockTimeoutPassed() {
|
||||
executeQuery('module.deleteLocksTimeoutPassed');
|
||||
}
|
||||
|
||||
function unlock($lock_name, $deadline) {
|
||||
$args->lock_name = $lock_name;
|
||||
$args->deadline = $deadline;
|
||||
$output = executeQuery('module.deleteLock', $args);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue