mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Data race related to reading/writing to AllocationTestModule.valid (#45191)
Summary: The fix entails making `AllocationTestModule.valid` an Objective-C atomic property and funneling access to the ivar via the synthesized property getter and setter. While the data race was present in test code, it would make it more difficult to spot more severe data races with the TSan. Also, getting rid of a data race is always good. ## Changelog: [iOS][Fixed] - Data race related to access of `AllocationTestModule.valid` Pull Request resolved: https://github.com/facebook/react-native/pull/45191 Test Plan: `RCTAllocationTests` will test the implementation of `AllocationTestModule`. Reviewed By: christophpurrer Differential Revision: D59155083 Pulled By: javache fbshipit-source-id: e3217cffd0801377a25f04bf8ed0b4e2d1d88498
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9269429bb9
commit
dba25fa966
@@ -16,7 +16,7 @@
|
||||
|
||||
@interface AllocationTestModule : NSObject <RCTBridgeModule, RCTInvalidating>
|
||||
|
||||
@property (nonatomic, assign, getter=isValid) BOOL valid;
|
||||
@property (atomic, assign, getter=isValid) BOOL valid;
|
||||
|
||||
@end
|
||||
|
||||
@@ -27,14 +27,14 @@ RCT_EXPORT_MODULE();
|
||||
- (instancetype)init
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
_valid = YES;
|
||||
self.valid = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)invalidate
|
||||
{
|
||||
_valid = NO;
|
||||
self.valid = NO;
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(test
|
||||
|
||||
Reference in New Issue
Block a user