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

Print this page




 299 
 300     if (!headless && !onMainThread) {
 301         if (verbose) AWT_DEBUG_LOG(@"about to wait on AppKit startup mutex");
 302 
 303         // Wait here for AppKit to have started (or for AWT to have been loaded into
 304         //  an already running NSApplication).
 305         pthread_mutex_lock(&sAppKitStarted_mutex);
 306         while (sAppKitStarted == NO) {
 307             pthread_cond_wait(&sAppKitStarted_cv, &sAppKitStarted_mutex);
 308         }
 309         pthread_mutex_unlock(&sAppKitStarted_mutex);
 310 
 311         // AWT gets here AFTER +[AWTStarter appKitIsRunning:] is called.
 312         if (verbose) AWT_DEBUG_LOG(@"got out of the AppKit startup mutex");
 313     }
 314 
 315     // Don't set the delegate until the NSApplication has been created and
 316     // its finishLaunching has initialized it.
 317     //  ApplicationDelegate is the support code for com.apple.eawt.
 318     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
 319         OSXAPP_SetApplicationDelegate([ApplicationDelegate sharedDelegate]);



 320     }];
 321 }
 322 
 323 - (void)starter:(NSArray*)args {
 324     NSAutoreleasePool *pool = [NSAutoreleasePool new];
 325 
 326     BOOL onMainThread = [[args objectAtIndex:0] boolValue];
 327     BOOL headless = [[args objectAtIndex:1] boolValue];
 328     BOOL verbose = [[args objectAtIndex:2] boolValue];
 329 
 330     BOOL wasOnMainThread = onMainThread;
 331 
 332     // Add the exception handler of last resort
 333     NSSetUncaughtExceptionHandler(AWT_NSUncaughtExceptionHandler);
 334 
 335     // Headless mode trumps either ordinary AWT or SWT-in-AWT mode.  Declare us a daemon and return.
 336     if (headless) {
 337         if (!forceEmbeddedMode) {
 338             setUpAppKitThreadName();
 339         }




 299 
 300     if (!headless && !onMainThread) {
 301         if (verbose) AWT_DEBUG_LOG(@"about to wait on AppKit startup mutex");
 302 
 303         // Wait here for AppKit to have started (or for AWT to have been loaded into
 304         //  an already running NSApplication).
 305         pthread_mutex_lock(&sAppKitStarted_mutex);
 306         while (sAppKitStarted == NO) {
 307             pthread_cond_wait(&sAppKitStarted_cv, &sAppKitStarted_mutex);
 308         }
 309         pthread_mutex_unlock(&sAppKitStarted_mutex);
 310 
 311         // AWT gets here AFTER +[AWTStarter appKitIsRunning:] is called.
 312         if (verbose) AWT_DEBUG_LOG(@"got out of the AppKit startup mutex");
 313     }
 314 
 315     // Don't set the delegate until the NSApplication has been created and
 316     // its finishLaunching has initialized it.
 317     //  ApplicationDelegate is the support code for com.apple.eawt.
 318     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
 319         id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
 320         if (delegate != nil) {
 321             OSXAPP_SetApplicationDelegate(delegate);
 322         }        
 323     }];
 324 }
 325 
 326 - (void)starter:(NSArray*)args {
 327     NSAutoreleasePool *pool = [NSAutoreleasePool new];
 328 
 329     BOOL onMainThread = [[args objectAtIndex:0] boolValue];
 330     BOOL headless = [[args objectAtIndex:1] boolValue];
 331     BOOL verbose = [[args objectAtIndex:2] boolValue];
 332 
 333     BOOL wasOnMainThread = onMainThread;
 334 
 335     // Add the exception handler of last resort
 336     NSSetUncaughtExceptionHandler(AWT_NSUncaughtExceptionHandler);
 337 
 338     // Headless mode trumps either ordinary AWT or SWT-in-AWT mode.  Declare us a daemon and return.
 339     if (headless) {
 340         if (!forceEmbeddedMode) {
 341             setUpAppKitThreadName();
 342         }