On Wed, 17 Mar 2010 10:36:40 -0400, Philippe Sismondi <psismo...@arqux.com> said: >Because the length of time that this secondary task takes is highly variable, I want to be able to cancel its processing from the main app. So, I want to launch the secondary task in a separate thread to keep the main runloop responsive. (This is of course a very common GUI issue.)
This is not a direct answer to your question, but my experience is that using NSOperationQueue and some form of NSOperation is a very good way to implement this. I use this approach any time I want a lengthy, cancellable process that leaves the GUI responsive. It keeps the threading issues very clear, and because the operation and the operation queue are ordinary objects, they can be retained and you can return to them at any time, which makes it very easy to collect the results when the operation ends, or to cancel the operation in the middle (in response to the user cancelling, for example). m. -- matt neuburg, phd = m...@tidbits.com, <http://www.tidbits.com/matt/> A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.tidbits.com/matt/default.html#applescriptthings _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com