Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[NSApp runModalSession] from Carbon app



I have a carbon app that should bring up a modal cocoa window. The app is multithreaded, with some of the threads being cooperative.

To bring up the modal window, I originally called [NSApp runModalForWindow], but I noted that this would not allow my cooperative thread to run. I therefore tried [NSApp runModalSession], e.g. as follows:

CocoaDialog* controller = [[ConvolutionDialog alloc] initWithNib:@"Convolution"];
NSModalSession session = [NSApp beginModalSessionForWindow: [controller window]];

while (1)
{ if ([NSApp runModalSession:session] != NSRunContinuesResponse)
break;
YieldToAnyThread();
}
[NSApp endModalSession:session];

[controller release];


I was hoping that runModalSession would return to the loop whenever it had nothing to do (according to the documentation, as far as I understood it, it should do that) so I can call YieldToAnyThread, giving my cooperative threads an opportunity to execute. However, I note that runModalSession returns only when the window is dismissed, and therefore I don't get the opportunity to call YieldToAnyThread.

Any advice what I am doing wrong here? Does runModalSession work as designed, or is this a bug? Any other way for achieving what I am trying to do?

TIA

Kurt Sutter

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.