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

Print this page




 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;
 340     }




 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     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
 314         OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]);
 315     }];





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