Skip to content

Commit

Permalink
ContainerLoader: mutex handling clarification (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored and dg committed Oct 26, 2021
1 parent 7d7a710 commit 942e406
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/DI/ContainerLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ private function loadFile(string $class, callable $generator): void
if (!$handle) {
throw new Nette\IOException(sprintf("Unable to create file '%s.lock'. %s", $file, Nette\Utils\Helpers::getLastError()));
} elseif (!@flock($handle, LOCK_EX)) { // @ is escalated to exception
// the lock will automatically be freed when $handle goes out of scope
throw new Nette\IOException(sprintf("Unable to acquire exclusive lock on '%s.lock'. %s", $file, Nette\Utils\Helpers::getLastError()));
}

Expand All @@ -92,7 +93,6 @@ private function loadFile(string $class, callable $generator): void
if ((@include $file) === false) { // @ - error escalated to exception
throw new Nette\IOException(sprintf("Unable to include '%s'.", $file));
}
flock($handle, LOCK_UN);
}


Expand Down

0 comments on commit 942e406

Please sign in to comment.