Re: updating NSView on separate thread
Re: updating NSView on separate thread
- Subject: Re: updating NSView on separate thread
- From: Michael Ash <email@hidden>
- Date: Mon, 1 Feb 2010 13:19:28 -0500
On Mon, Feb 1, 2010 at 10:20 AM, Kyle Sluder <email@hidden> wrote:
> Ooh. So you need to perform this operation synchronously but still pole the
> main thread (performing UI work is actually irrelevant; you need to run the
> runloop to avoid the spinning beachball anyway).
>
> So in your override of -writeToURL:…, spin off the background thread like I
> suggested, then set up your UI, and then start running the runloop in a
> special modal mode until your background thread is done.
Running the runloop is necessary but not sufficient to avoid a SPOD.
What you need to do to avoid that is to process events.
One solution to all these various problems is to put up a modal panel.
It processes events, thus avoiding the SPOD, it uses a special runloop
mode, avoiding recursive callouts, it gives you a place to put your
progress graphics, and it prevents the user from messing with the rest
of your app while all this is going on.
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