| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
Le 6 avr. 08 à 08:55, Kurt Sutter a écrit : I have a carbon app that should bring up a modal cocoa window. The app is multithreaded, with some of the threads being cooperative. You should not use runModalSession this way. See the discussion part in this method documentation: “You must invoke this method frequently enough in your loop that the window remains responsive to events. However, you should not invoke this method in a tight loop because it returns immediately if there are no events, and consequently you could end up polling for events rather than blocking. Typically, you use this method in situations where you want to do some additional background processing while the modal loop runs. For example, while processing a large data set, you might want to use a modal dialog to display progress and give the user a chance to cancel the operation. If you want to display a modal dialog and do not need to do any additional work in parallel, use runModalForWindow: instead. When there are no pending events, that method waits idly instead of consuming CPU time.” This is maybe not clear, but you should use this method only if you plan to do some background processing on the main thread. If you do some background processing in other thread, do not bother with manual session management and use - [NSApplication runModalForWindow:] instead. Basically, your code should be: CocoaDialog *controller = [[ConvolutionDialog alloc] initWithNib:@"Convolution"]; [NSApp runModalForWindow:[controller window]]; [controller release]; |
_______________________________________________ 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
| References: | |
| >[NSApp runModalSession] from Carbon app (From: Kurt Sutter <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
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.