diff -ru typo3_src.orig/t3lib/class.t3lib_lock.php typo3_src.new/t3lib/class.t3lib_lock.php --- typo3_src.orig/t3lib/class.t3lib_lock.php 2010-09-01 19:48:42.000000000 +0200 +++ typo3_src.new/t3lib/class.t3lib_lock.php 2010-09-09 15:50:32.000000000 +0200 @@ -149,26 +149,25 @@ 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 !== FALSE) { + 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) { @@ -293,4 +292,4 @@ 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']); } -?> \ No newline at end of file +?>