Skip to content
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

Add a mutex to protect f.offset in new File.Read #372

Merged
merged 1 commit into from
Aug 21, 2020

Conversation

puellanivis
Copy link
Collaborator

@puellanivis puellanivis commented Aug 19, 2020

With the new ReaderAt support, we have a safer concurrent access method, but offset itself could end up in race-conditions if Read is called by multiple parallel threads.

This puts a mutex in there just to be safe. No other fields of File seem to need any protection, as they are not mutated over time.

@puellanivis puellanivis merged commit a6e55f6 into master Aug 21, 2020
@puellanivis puellanivis deleted the hotfix/add-a-mutex-for-File-Read branch August 21, 2020 08:04
@lespea
Copy link

lespea commented Aug 21, 2020

Just curious if you were planning on doing a release soon or if you're waiting for some other PR's to land?

@puellanivis
Copy link
Collaborator Author

It should be shortly, just gotta clear up some issues with the example code being moved into _test.go files, and a possible memory corruption bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants