mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
[Bridge] remove unused semaphore
Summary: dispatch_semaphore_wait with DISPATCH_TIME_NOW don't wait for the semaphore. It just test whether there's a signal and return the result. So the line "dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW);" does nothing here. It seems like a bug, but each executing in js thread will be queued, so it's safe to remove the unused semaphore instead of wait for it. Closes https://github.com/facebook/react-native/pull/1915 Github Author: DengYun <tdzl2003@gmail.com>
This commit is contained in:
parent
61c648d564
commit
3c78aa6d25
@ -235,18 +235,13 @@ RCT_NOT_IMPLEMENTED(-initWithBundleURL:(__unused NSURL *)bundleURL
|
||||
NSString *configJSON = RCTJSONStringify(@{
|
||||
@"remoteModuleConfig": config,
|
||||
}, NULL);
|
||||
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
|
||||
[_javaScriptExecutor injectJSONText:configJSON
|
||||
asGlobalObjectNamed:@"__fbBatchedBridgeConfig" callback:
|
||||
^(NSError *error) {
|
||||
if (error) {
|
||||
[[RCTRedBox sharedInstance] showError:error];
|
||||
}
|
||||
|
||||
dispatch_semaphore_signal(semaphore);
|
||||
}];
|
||||
|
||||
dispatch_semaphore_wait(semaphore, DISPATCH_TIME_NOW);
|
||||
asGlobalObjectNamed:@"__fbBatchedBridgeConfig"
|
||||
callback:^(NSError *error) {
|
||||
if (error) {
|
||||
[[RCTRedBox sharedInstance] showError:error];
|
||||
}
|
||||
}];
|
||||
|
||||
NSURL *bundleURL = _parentBridge.bundleURL;
|
||||
if (_javaScriptExecutor == nil) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user