mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-26 10:58:58 +00:00
8022291: Mac OS: Unexpected JavaLaunchHelper message displaying
Reviewed-by: serb, ksrini
This commit is contained in:
parent
035a4b7b98
commit
cadb9794d9
@ -1053,32 +1053,6 @@ SetXStartOnFirstThreadArg()
|
||||
setenv(envVar, "1", 1);
|
||||
}
|
||||
|
||||
/* This class is made for performSelectorOnMainThread when java main
|
||||
* should be launched on main thread.
|
||||
* We cannot use dispatch_sync here, because it blocks the main dispatch queue
|
||||
* which is used inside Cocoa
|
||||
*/
|
||||
@interface JavaLaunchHelper : NSObject {
|
||||
int _returnValue;
|
||||
}
|
||||
- (void) launchJava:(NSValue*)argsValue;
|
||||
- (int) getReturnValue;
|
||||
@end
|
||||
|
||||
@implementation JavaLaunchHelper
|
||||
|
||||
- (void) launchJava:(NSValue*)argsValue
|
||||
{
|
||||
_returnValue = JavaMain([argsValue pointerValue]);
|
||||
}
|
||||
|
||||
- (int) getReturnValue
|
||||
{
|
||||
return _returnValue;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
// MacOSX we may continue in the same thread
|
||||
int
|
||||
JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
|
||||
@ -1088,20 +1062,26 @@ JVMInit(InvocationFunctions* ifn, jlong threadStackSize,
|
||||
JLI_TraceLauncher("In same thread\n");
|
||||
// need to block this thread against the main thread
|
||||
// so signals get caught correctly
|
||||
JavaMainArgs args;
|
||||
args.argc = argc;
|
||||
args.argv = argv;
|
||||
args.mode = mode;
|
||||
args.what = what;
|
||||
args.ifn = *ifn;
|
||||
int rslt;
|
||||
__block int rslt = 0;
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
{
|
||||
JavaLaunchHelper* launcher = [[[JavaLaunchHelper alloc] init] autorelease];
|
||||
[launcher performSelectorOnMainThread:@selector(launchJava:)
|
||||
withObject:[NSValue valueWithPointer:(void*)&args]
|
||||
waitUntilDone:YES];
|
||||
rslt = [launcher getReturnValue];
|
||||
NSBlockOperation *op = [NSBlockOperation blockOperationWithBlock: ^{
|
||||
JavaMainArgs args;
|
||||
args.argc = argc;
|
||||
args.argv = argv;
|
||||
args.mode = mode;
|
||||
args.what = what;
|
||||
args.ifn = *ifn;
|
||||
rslt = JavaMain(&args);
|
||||
}];
|
||||
|
||||
/*
|
||||
* We cannot use dispatch_sync here, because it blocks the main dispatch queue.
|
||||
* Using the main NSRunLoop allows the dispatch queue to run properly once
|
||||
* SWT (or whatever toolkit this is needed for) kicks off it's own NSRunLoop
|
||||
* and starts running.
|
||||
*/
|
||||
[op performSelectorOnMainThread:@selector(start) withObject:nil waitUntilDone:YES];
|
||||
}
|
||||
[pool drain];
|
||||
return rslt;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user