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

First attempt to fix deadlock in GetOrCreate #753

Open
wants to merge 2 commits into
base: uwp/main
Choose a base branch
from

Conversation

benstevens48
Copy link

This is an attempt to fix issue #663. I have tried to do it in such a way as to improve concurrency by locking for less of the time rather than more. The basic idea is quite simple, although it ended up being slightly more complicated than I would have liked.

The basic idea is that if two threads happen to want to create a wrapper around the same resource at the same time, which seems very unlikely, then let them do the same work in parallel, but then only return one of the created wrappers and discard the other. This allows us to release the lock for the construction of the wrapper.

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.

1 participant