Increase QoS of JavaScript thread on iOS 8+

Summary: This thread is effectively the "main thread" for JavaScript code in React Native applications, so it should have as high a quality-of-service as possible.

public

Reviewed By: javache, nicklockwood

Differential Revision: D2641878

fb-gh-sync-id: 3c60c1abeeab9e7405d6fc9602e0d4ccfab1ea1b
This commit is contained in:
Justin Spahr-Summers 2015-11-12 05:19:59 -08:00 committed by facebook-github-bot-6
parent ce2bb0fe16
commit a1d8ea2ac1

View File

@ -279,7 +279,13 @@ static void RCTInstallJSCProfiler(RCTBridge *bridge, JSContextRef context)
selector:@selector(runRunLoopThread)
object:nil];
javaScriptThread.name = @"com.facebook.React.JavaScript";
javaScriptThread.threadPriority = [NSThread mainThread].threadPriority;
if ([javaScriptThread respondsToSelector:@selector(setQualityOfService:)]) {
[(id)javaScriptThread setQualityOfService:NSOperationQualityOfServiceUserInteractive];
} else {
javaScriptThread.threadPriority = [NSThread mainThread].threadPriority;
}
[javaScriptThread start];
return [self initWithJavaScriptThread:javaScriptThread context:nil];