-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve thread safety of ReactNativeFeatureFlags (#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] Differential Revision: D53406924
- Loading branch information
1 parent
d66d651
commit 9cdde53
Showing
6 changed files
with
176 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.