Re: GUI threading question
Re: GUI threading question
- Subject: Re: GUI threading question
- From: Michael Ash <email@hidden>
- Date: Mon, 2 Feb 2009 11:39:55 -0500
On Mon, Feb 2, 2009 at 11:03 AM, Scott Ribe <email@hidden> wrote:
>> It has long been my understanding that in order to keep a GUI from
>> freezing in Cocoa during LONG methods you have to create a
>> NSOperationQueue and load the method as a NSInvocationOperation as seen
>
> No, you have to run the long operations on another thread. NSOperationQueue
> is supposed to provide an easy way to do that, but it's not necessary. You
> can start a thread and arrange to receive its results using NSThread, or
> MPTasks, or pthreads...
Or you can spawn another process and talk to it asynchronously. Or you
can break your LONG method up into a bunch of SHORT operations, which
you then call from a timer.
The only thing you HAVE to do to keep the GUI responsive is not block
the event loop for a noticeable amount of time. How you actually do
that is entirely up to you. NSOperation is just one of many options.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden