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

Make mode descriptor cache initialization thread-safe. #2351

Merged

Conversation

gunjambi
Copy link
Contributor

Initializing mode descriptor cache in-place is racy and may cause a thread to
observe a partially constructed cache if another thread is pre-empted while
it's still constructing the cache. In this change, the mode descriptor cache is
constructed into a local variable instead and then set globally in a single
atomic operation, preventing any possibility of observing an incomplete cache.

Initializing mode descriptor cache in-place is racy and may cause a thread to
observe a partially constructed cache if another thread is pre-empted while
it's still constructing the cache. In this change, the mode descriptor cache is
constructed into a local variable instead and then set globally in a single
atomic operation, preventing any possibility of observing an incomplete cache.
@wiredfool wiredfool merged commit 579c716 into python-pillow:master Jan 16, 2017
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.

None yet

2 participants