Bug #19112 » t3lib_lock.patch
typo3_src-4.2.8/t3lib/class.t3lib_lock.php 2009-09-25 11:07:36.111587718 +0200 | ||
---|---|---|
switch ($this->method) {
|
||
case 'simple':
|
||
if (is_file($this->resource)) {
|
||
if (is_file($this->resource))
|
||
$this->sysLog('Waiting for a different process to release the lock');
|
||
$i = 0;
|
||
while ($i<$this->loops) {
|
||
$i++;
|
||
usleep($this->step*1000);
|
||
clearstatcache();
|
||
if (!is_file($this->resource)) { // Lock became free, leave the loop
|
||
$this->sysLog('Different process released the lock');
|
||
$noWait = false;
|
||
break;
|
||
}
|
||
$isAcquired = false;
|
||
$noWait = True;
|
||
for ($i = 0; $i < $this->loops; $i++) {
|
||
$f = @fopen($this->resource, "x");
|
||
if ($f != NULL) {
|
||
fclose($f);
|
||
$this->sysLog('Lock aquired');
|
||
$noWait = ($i == 0);
|
||
$isAcquired = true;
|
||
break;
|
||
}
|
||
} else {
|
||
$noWait = true;
|
||
usleep($this->step*1000);
|
||
}
|
||
if (($this->filepointer = touch($this->resource)) == false) {
|
||
if (!$isAcquired)
|
||
throw new Exception('Lock file could not be created');
|
||
}
|
||
break;
|
||
case 'flock':
|
||
if (($this->filepointer = fopen($this->resource, 'w+')) == false) {
|
||
... | ... | |
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_lock.php']) {
|
||
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_lock.php']);
|
||
}
|
||
?>
|
||
?>
|