Re: idle processing on main thread suggestions?
Re: idle processing on main thread suggestions?
- Subject: Re: idle processing on main thread suggestions?
- From: Hsu <email@hidden>
- Date: Mon, 18 Dec 2006 20:10:56 -0800
Use NSNotificationQueue to send a notification using NSPostWhenIdle.
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
Classes/NSNotificationQueue_Class/index.html#//apple_ref/doc/uid/
TP40003702
Karl
On Dec 18, 2006, at 2:45 PM, Ben Zotto wrote:
Hi all,
I have an app that is targeting fast-response UI. But I'm handling
a large number of NSImages, many of which can have quite large
resolutions. What I'd like to do is somehow get methods called on
my main thread that will refine the image quality, etc, but only
after the app state has settled, and I'm not processing user events.
A way to think of this is: loading a document makes a bunch of
custom drawing and stuff happen, but I can do the "low res" version
of all this stuff up front for faster response with thumbnails,
etc, and then when the app has "settled" I can quietly load in
higher-res stuff and draw them in place.
A worker thread isn't really the answer I'm looking for, since
queueing up all this work which might involve disk I/O in my worker
thread pool slows down the main thread as well (or deadlocks it
with some internal NSImage appkit lock). A timer is not awesome
since I can't predict when things will be idle.
Is there a way to queue some user event only when the event queue
is empty? I can divide the work up into small slices, I just want
a smart way to meter the execution of the small slices.
Thanks for any thoughts or research hints.
Ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
40earthlink.net
This email sent to email@hidden
--
668 - the Neighbor of the Beast
Homepage:
http://homepage.mac.com/khsu/index.html
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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