MDL-65072 core_lock: Locks with a zero timeout return asap

This commit is contained in:
Brendan Heywood
2019-03-26 14:29:16 +11:00
parent 3271c39c74
commit ecbe920656
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -152,7 +152,7 @@ class file_lock_factory implements lock_factory {
// Will block on windows. So sad.
$wouldblock = false;
$locked = flock($filehandle, LOCK_EX | LOCK_NB, $wouldblock);
if (!$locked && $wouldblock) {
if (!$locked && $wouldblock && $timeout > 0) {
usleep(rand(10000, 250000)); // Sleep between 10 and 250 milliseconds.
}
// Try until the giveup time.