-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent data race when closing active file #60
Conversation
This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request. |
I also left this same comment in #59, but: We already have an "atomicBool" type in this file used for a different bool with a similar issue. I'd prefer to use that instead of adding a Mutex.
See I've confirmed that this makes the race detector happy. |
22928a7
to
6cd24b4
Compare
This should prevent a race that usually happens when `closeHandle()` and `prepareIo()` are called concurrently; the former tries to set `closing` to `true` the latter tries to read its value. Signed-off-by: Kenfe-Mickael Laventure <[email protected]>
6cd24b4
to
9bdb224
Compare
@darrenstahlmsft updated, used a compare-and-swap for setting closing to true though. |
#59 was merged, so I'm closing this. Thanks though! |
Thanks, any timeline on a 0.4.4 release?
On Tue, Jul 25, 2017, 12:08 AM Darren Stahl ***@***.***> wrote:
Closed #60 <#60>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#60 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/APUifkOa35DMZFmUwaXq9KiCDbWswDWFks5sRWpSgaJpZM4Oc962>
.
--
Sent from my phone.
|
I merged that on my phone last night, taking v0.4.4 right now. |
The race usually happens when
closeHandle()
andprepareIo()
are calledconcurrently; the former tries to set
closing
totrue
the latter triesto read its value.
In order to avoid this issue, we added a lock around the variable.
Signed-off-by: Kenfe-Mickael Laventure [email protected]