src/macosx/native/sun/awt/awt.m

Print this page




 290         [st starter:args];
 291     } else {
 292         [st performSelectorOnMainThread: @selector(starter:) withObject:args waitUntilDone:NO];
 293     }
 294 
 295     if (!headless && !onMainThread) {
 296         if (verbose) AWT_DEBUG_LOG(@"about to wait on AppKit startup mutex");
 297 
 298         // Wait here for AppKit to have started (or for AWT to have been loaded into
 299         //  an already running NSApplication).
 300         pthread_mutex_lock(&sAppKitStarted_mutex);
 301         while (sAppKitStarted == NO) {
 302             pthread_cond_wait(&sAppKitStarted_cv, &sAppKitStarted_mutex);
 303         }
 304         pthread_mutex_unlock(&sAppKitStarted_mutex);
 305 
 306         // AWT gets here AFTER +[AWTStarter appKitIsRunning:] is called.
 307         if (verbose) AWT_DEBUG_LOG(@"got out of the AppKit startup mutex");
 308     }
 309 

 310     // Don't set the delegate until the NSApplication has been created and
 311     // its finishLaunching has initialized it.
 312     //  ApplicationDelegate is the support code for com.apple.eawt.
 313     void (^setDelegateBlock)() = ^(){
 314         OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]);
 315     };
 316     if (onMainThread) {
 317         setDelegateBlock();
 318     } else {
 319         [JNFRunLoop performOnMainThreadWaiting:YES withBlock:setDelegateBlock];

 320     }
 321 }
 322 
 323 - (void)starter:(NSArray*)args {
 324     NSAutoreleasePool *pool = [NSAutoreleasePool new];
 325 
 326     BOOL onMainThread = [[args objectAtIndex:0] boolValue];
 327     BOOL swtMode = [[args objectAtIndex:1] boolValue];
 328     BOOL headless = [[args objectAtIndex:2] boolValue];
 329     BOOL swtModeForWebStart = [[args objectAtIndex:3] boolValue];
 330     BOOL verbose = [[args objectAtIndex:4] boolValue];
 331 
 332     BOOL wasOnMainThread = onMainThread;
 333 
 334     setUpAWTAppKit(swtMode, headless);
 335 
 336     // Headless mode trumps either ordinary AWT or SWT-in-AWT mode.  Declare us a daemon and return.
 337     if (headless) {
 338         BOOL didBecomeDaemon = [AWTStarter markAppAsDaemon];
 339         return;




 290         [st starter:args];
 291     } else {
 292         [st performSelectorOnMainThread: @selector(starter:) withObject:args waitUntilDone:NO];
 293     }
 294 
 295     if (!headless && !onMainThread) {
 296         if (verbose) AWT_DEBUG_LOG(@"about to wait on AppKit startup mutex");
 297 
 298         // Wait here for AppKit to have started (or for AWT to have been loaded into
 299         //  an already running NSApplication).
 300         pthread_mutex_lock(&sAppKitStarted_mutex);
 301         while (sAppKitStarted == NO) {
 302             pthread_cond_wait(&sAppKitStarted_cv, &sAppKitStarted_mutex);
 303         }
 304         pthread_mutex_unlock(&sAppKitStarted_mutex);
 305 
 306         // AWT gets here AFTER +[AWTStarter appKitIsRunning:] is called.
 307         if (verbose) AWT_DEBUG_LOG(@"got out of the AppKit startup mutex");
 308     }
 309 
 310     if (!headless) {
 311         // Don't set the delegate until the NSApplication has been created and
 312         // its finishLaunching has initialized it.
 313         //  ApplicationDelegate is the support code for com.apple.eawt.
 314         void (^setDelegateBlock)() = ^(){
 315             OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]);
 316         };
 317         if (onMainThread) {
 318             setDelegateBlock();
 319         } else {
 320             [JNFRunLoop performOnMainThreadWaiting:YES withBlock:setDelegateBlock];
 321         }
 322     }
 323 }
 324 
 325 - (void)starter:(NSArray*)args {
 326     NSAutoreleasePool *pool = [NSAutoreleasePool new];
 327 
 328     BOOL onMainThread = [[args objectAtIndex:0] boolValue];
 329     BOOL swtMode = [[args objectAtIndex:1] boolValue];
 330     BOOL headless = [[args objectAtIndex:2] boolValue];
 331     BOOL swtModeForWebStart = [[args objectAtIndex:3] boolValue];
 332     BOOL verbose = [[args objectAtIndex:4] boolValue];
 333 
 334     BOOL wasOnMainThread = onMainThread;
 335 
 336     setUpAWTAppKit(swtMode, headless);
 337 
 338     // Headless mode trumps either ordinary AWT or SWT-in-AWT mode.  Declare us a daemon and return.
 339     if (headless) {
 340         BOOL didBecomeDaemon = [AWTStarter markAppAsDaemon];
 341         return;