-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Improve thread safety of ReactNativeFeatureFlags #42870
Conversation
This pull request was exported from Phabricator. Differential Revision: D53406924 |
Summary: This refactors `ReactNativeFeatureFlagsAccessor` in C++ to improve its thread-safety: * It makes all cached feature flags atomic to prevent data corruption when writing them concurrently. * It refactors the list of accessed feature flags to be an array of atomic character pointers instead of a vector. Performance-wise, this is lock-free so it would still be fast enough for our use cases. Semantic-wise, this implementation could lead to feature flags being initialized more than once (if 2 threads happen to access the same feature flag before it has been initialized), but that's ok. The only consequence of this would be accessing the provider twice, but the end state of the accessor is the same (the same value would be cached and the flag would still be marked as accessed). Changelog: [internal] Differential Revision: D53406924
739f2f1
to
9cdde53
Compare
This pull request was exported from Phabricator. Differential Revision: D53406924 |
Base commit: f3977af |
Summary: This refactors `ReactNativeFeatureFlagsAccessor` in C++ to improve its thread-safety: * It makes all cached feature flags atomic to prevent data corruption when writing them concurrently. * It refactors the list of accessed feature flags to be an array of atomic character pointers instead of a vector. Performance-wise, this is lock-free so it would still be fast enough for our use cases. Semantic-wise, this implementation could lead to feature flags being initialized more than once (if 2 threads happen to access the same feature flag before it has been initialized), but that's ok. The only consequence of this would be accessing the provider twice, but the end state of the accessor is the same (the same value would be cached and the flag would still be marked as accessed). Changelog: [internal] Reviewed By: javache Differential Revision: D53406924
9cdde53
to
a20e6bf
Compare
This pull request was exported from Phabricator. Differential Revision: D53406924 |
Summary: This refactors `ReactNativeFeatureFlagsAccessor` in C++ to improve its thread-safety: * It makes all cached feature flags atomic to prevent data corruption when writing them concurrently. * It refactors the list of accessed feature flags to be an array of atomic character pointers instead of a vector. Performance-wise, this is lock-free so it would still be fast enough for our use cases. Semantic-wise, this implementation could lead to feature flags being initialized more than once (if 2 threads happen to access the same feature flag before it has been initialized), but that's ok. The only consequence of this would be accessing the provider twice, but the end state of the accessor is the same (the same value would be cached and the flag would still be marked as accessed). Changelog: [internal] Reviewed By: javache Differential Revision: D53406924
a20e6bf
to
641b002
Compare
This pull request was exported from Phabricator. Differential Revision: D53406924 |
Summary: This refactors `ReactNativeFeatureFlagsAccessor` in C++ to improve its thread-safety: * It makes all cached feature flags atomic to prevent data corruption when writing them concurrently. * It refactors the list of accessed feature flags to be an array of atomic character pointers instead of a vector. Performance-wise, this is lock-free so it would still be fast enough for our use cases. Semantic-wise, this implementation could lead to feature flags being initialized more than once (if 2 threads happen to access the same feature flag before it has been initialized), but that's ok. The only consequence of this would be accessing the provider twice, but the end state of the accessor is the same (the same value would be cached and the flag would still be marked as accessed). Changelog: [internal] Reviewed By: javache Differential Revision: D53406924
641b002
to
2a09a6a
Compare
This pull request was exported from Phabricator. Differential Revision: D53406924 |
Summary: This refactors `ReactNativeFeatureFlagsAccessor` in C++ to improve its thread-safety: * It makes all cached feature flags atomic to prevent data corruption when writing them concurrently. * It refactors the list of accessed feature flags to be an array of atomic character pointers instead of a vector. Performance-wise, this is lock-free so it would still be fast enough for our use cases. Semantic-wise, this implementation could lead to feature flags being initialized more than once (if 2 threads happen to access the same feature flag before it has been initialized), but that's ok. The only consequence of this would be accessing the provider twice, but the end state of the accessor is the same (the same value would be cached and the flag would still be marked as accessed). Changelog: [internal] Reviewed By: javache Differential Revision: D53406924
2a09a6a
to
8a7f427
Compare
This pull request was exported from Phabricator. Differential Revision: D53406924 |
…42870) Summary: This refactors `ReactNativeFeatureFlagsAccessor` in C++ to improve its thread-safety: * It makes all cached feature flags atomic to prevent data corruption when writing them concurrently. * It refactors the list of accessed feature flags to be an array of atomic character pointers instead of a vector. Performance-wise, this is lock-free so it would still be fast enough for our use cases. Semantic-wise, this implementation could lead to feature flags being initialized more than once (if 2 threads happen to access the same feature flag before it has been initialized), but that's ok. The only consequence of this would be accessing the provider twice, but the end state of the accessor is the same (the same value would be cached and the flag would still be marked as accessed). Changelog: [internal] Reviewed By: javache Differential Revision: D53406924
Summary: This refactors `ReactNativeFeatureFlagsAccessor` in C++ to improve its thread-safety: * It makes all cached feature flags atomic to prevent data corruption when writing them concurrently. * It refactors the list of accessed feature flags to be an array of atomic character pointers instead of a vector. Performance-wise, this is lock-free so it would still be fast enough for our use cases. Semantic-wise, this implementation could lead to feature flags being initialized more than once (if 2 threads happen to access the same feature flag before it has been initialized), but that's ok. The only consequence of this would be accessing the provider twice, but the end state of the accessor is the same (the same value would be cached and the flag would still be marked as accessed). Changelog: [internal] Reviewed By: javache Differential Revision: D53406924
8a7f427
to
d0a8ea3
Compare
This pull request was exported from Phabricator. Differential Revision: D53406924 |
Summary: This refactors `ReactNativeFeatureFlagsAccessor` in C++ to improve its thread-safety: * It makes all cached feature flags atomic to prevent data corruption when writing them concurrently. * It refactors the list of accessed feature flags to be an array of atomic character pointers instead of a vector. Performance-wise, this is lock-free so it would still be fast enough for our use cases. Semantic-wise, this implementation could lead to feature flags being initialized more than once (if 2 threads happen to access the same feature flag before it has been initialized), but that's ok. The only consequence of this would be accessing the provider twice, but the end state of the accessor is the same (the same value would be cached and the flag would still be marked as accessed). Changelog: [internal] Reviewed By: javache Differential Revision: D53406924
d0a8ea3
to
abe44a1
Compare
This pull request was exported from Phabricator. Differential Revision: D53406924 |
Summary: This refactors `ReactNativeFeatureFlagsAccessor` in C++ to improve its thread-safety: * It makes all cached feature flags atomic to prevent data corruption when writing them concurrently. * It refactors the list of accessed feature flags to be an array of atomic character pointers instead of a vector. Performance-wise, this is lock-free so it would still be fast enough for our use cases. Semantic-wise, this implementation could lead to feature flags being initialized more than once (if 2 threads happen to access the same feature flag before it has been initialized), but that's ok. The only consequence of this would be accessing the provider twice, but the end state of the accessor is the same (the same value would be cached and the flag would still be marked as accessed). Changelog: [internal] Reviewed By: javache Differential Revision: D53406924
abe44a1
to
2e04cd5
Compare
This pull request was exported from Phabricator. Differential Revision: D53406924 |
…42870) Summary: This refactors `ReactNativeFeatureFlagsAccessor` in C++ to improve its thread-safety: * It makes all cached feature flags atomic to prevent data corruption when writing them concurrently. * It refactors the list of accessed feature flags to be an array of atomic character pointers instead of a vector. Performance-wise, this is lock-free so it would still be fast enough for our use cases. Semantic-wise, this implementation could lead to feature flags being initialized more than once (if 2 threads happen to access the same feature flag before it has been initialized), but that's ok. The only consequence of this would be accessing the provider twice, but the end state of the accessor is the same (the same value would be cached and the flag would still be marked as accessed). Changelog: [internal] Reviewed By: javache Differential Revision: D53406924
Summary: This refactors `ReactNativeFeatureFlagsAccessor` in C++ to improve its thread-safety: * It makes all cached feature flags atomic to prevent data corruption when writing them concurrently. * It refactors the list of accessed feature flags to be an array of atomic character pointers instead of a vector. Performance-wise, this is lock-free so it would still be fast enough for our use cases. Semantic-wise, this implementation could lead to feature flags being initialized more than once (if 2 threads happen to access the same feature flag before it has been initialized), but that's ok. The only consequence of this would be accessing the provider twice, but the end state of the accessor is the same (the same value would be cached and the flag would still be marked as accessed). Changelog: [internal] Reviewed By: javache Differential Revision: D53406924
2e04cd5
to
f9eaae4
Compare
This pull request was exported from Phabricator. Differential Revision: D53406924 |
This pull request has been merged in fe69f71. |
Summary:
This refactors
ReactNativeFeatureFlagsAccessor
in C++ to improve its thread-safety:Performance-wise, this is lock-free so it would still be fast enough for our use cases.
Semantic-wise, this implementation could lead to feature flags being initialized more than once (if 2 threads happen to access the same feature flag before it has been initialized), but that's ok. The only consequence of this would be accessing the provider twice, but the end state of the accessor is the same (the same value would be cached and the flag would still be marked as accessed).
Changelog: [internal]
Differential Revision: D53406924