Skip to content

ContainerLoader: simplify mutex handling#270

Merged
dg merged 3 commits into
nette:masterfrom
staabm:patch-1
Oct 26, 2021
Merged

ContainerLoader: simplify mutex handling#270
dg merged 3 commits into
nette:masterfrom
staabm:patch-1

Conversation

@staabm

@staabm staabm commented Oct 22, 2021

Copy link
Copy Markdown
Contributor

the code as was before this PR, did not release the file-mutex on e.g. one of the Nette\IOException throwing cases

@staabm staabm changed the title ContainerLoader: make sure file-muted is released when exceptions are thrown ContainerLoader: make sure file-mutex is released when exceptions are thrown Oct 22, 2021
Comment thread src/DI/ContainerLoader.php
@milo

milo commented Oct 24, 2021

Copy link
Copy Markdown
Member

Some prove that the lock was not released?

@staabm

staabm commented Oct 24, 2021

Copy link
Copy Markdown
Contributor Author

You mean a unit test?

@dg

dg commented Oct 24, 2021

Copy link
Copy Markdown
Member

I think the flock($handle, LOCK_UN) is completely unnecessary in the current code and thus your modification has no effect.

@staabm

staabm commented Oct 24, 2021

Copy link
Copy Markdown
Contributor Author

So the idea is: it is useless because the handle is stored in a local variable which frees the handle and the lock when the variable is going out of scope?

@dg

dg commented Oct 24, 2021

Copy link
Copy Markdown
Member

Yeah, exactly.

@staabm staabm changed the title ContainerLoader: make sure file-mutex is released when exceptions are thrown ContainerLoader: simplify mutex handling Oct 26, 2021
@staabm

staabm commented Oct 26, 2021

Copy link
Copy Markdown
Contributor Author

as discussed, I adjusted the PR to remove the UNLOCK line (and added a comment).

@dg

dg commented Oct 26, 2021

Copy link
Copy Markdown
Member

Thanks

@dg dg merged commit 6c57b33 into nette:master Oct 26, 2021
@staabm staabm deleted the patch-1 branch October 26, 2021 09:03
dg added a commit that referenced this pull request Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants