-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a race condition if PathRequest::doCreate races with the path bei…
…ng processed.
- Loading branch information
Showing
1 changed file
with
3 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4620b66
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised that a race condition is fixed with this microscopic change. And less surprised that there are no supporting comments.
4620b66
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's obvious what the code does -- it saves the status inside the object in a local variable which is then returns. The previous code didn't do this. That there's a possible race condition is an artifact of the code history. When you create an object, you have exclusive use of it and don't need any locks until you put it where other code can find it. After that, you have to follow its locking rules.
4620b66
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obvious to you