Fixing Race condition that happens with _wasBatchActive

Summary:
Issue Fix: #13485

Yet another race condition that was found by XCode's Thread Sanitizer.
Happens because wasBatchActive is read/write from multiple threads at the same time

- opened UIExplorer and see it works
- npm run test pass
- tested on own project as well

Signed CLA
Closes https://github.com/facebook/react-native/pull/13505

Differential Revision: D4906096

Pulled By: javache

fbshipit-source-id: 5d4329aafcfe9491ce0188fa1e2dd71e09b31031
This commit is contained in:
Andrew Tokarev
2017-04-19 02:53:30 -07:00
committed by Facebook Github Bot
parent 9b882a3b44
commit 460e77d47d
2 changed files with 7 additions and 7 deletions

View File

@@ -47,7 +47,7 @@ typedef NS_ENUM(NSUInteger, RCTBridgeFields) {
@implementation RCTBatchedBridge
{
BOOL _wasBatchActive;
std::atomic_bool _wasBatchActive;
NSMutableArray<dispatch_block_t> *_pendingCalls;
NSDictionary<NSString *, RCTModuleData *> *_moduleDataByName;
NSArray<RCTModuleData *> *_moduleDataByID;