Re: Threading - How its done?
Re: Threading - How its done?
- Subject: Re: Threading - How its done?
- From: glenn andreas <email@hidden>
- Date: Tue, 6 May 2008 13:38:37 -0500
On May 6, 2008, at 1:30 PM, Army Research Lab wrote:
To the original poster:
How much experience do you have with threads? I'm a little confused
reading
through your posts, I can't tell if you are familiar with pthreads,
and just
need to figure out NSThreads, or if you have no threading experience
at all.
To everyone that has both Cocoa and threading experience:
Can NSView rendering be done on a worker thread, but without
displaying the
results? It occurred to me that if this is possible, another option
to the
original problem would be to have a pool of worker threads that
render the
thumbnails/PDFviews in the background. It would simply be a matter of
having a thread-safe priority queue (so if the user clicks on a
thumbnail,
it gets jumped to the head of the queue), and let the threads grab
whatever
happens to be the highest priority to work on, returning the results
to the
main thread to display later. Alternatively, each time you click on a
thumbnail, it could spawn a thread, with the thread returning the
results to
the main thread when it is done.
Nothing prevents you from rendering to an offscreen bitmap context in
a thread and then feeding that image back to a main view (it's
actually fairly simple since all you need to coordinate is the "take
the next job from the queue"/"put the result on another queue" which
are fairly straight forward threading exercises). I use this exact
technique to prove a "media browser" like view and it works quite well
(and I wouldn't be surprised if IKImageBrowser didn't do the same).
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
m.o.t.e.s. | minute object twisted environment simulation
_______________________________________________
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