Thanks to all that posted.

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.


As I said earlier on, I don't have ANY experience with threading at all - this was my first attempt to try and understand how to implement a threading scheme. The Apple documentation was my first port of call and at least the basics of it, I got from those articles. I found a great deal of reading material online however I think the noise of hearing the same comments "Threading is hard ..." etc made this all the more difficult. This mailing list has in one day at least, given me some clear guidance on my next approach which I really appreciate. At some point though, to take things out of the theoretical, you have to put things into practice. Granted my approach may have been very hit and miss but it certainly accelerated my learning!


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.

This idea is exactly what I was trying to achieve - The idea of the thumbnail creation and the PDF loading happening in a separate thread. However to have a thread safe priority queue to organize the "Worker Threads" sounds like the missing link - And with that some safe way to cancel Threads that have been outdated by the user before that Thread had time to set the PDF View! I am assuming in a priority queue this function could exist?


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).

Rendering to an offscreen bitmap (in another thread) is also another idea I haven't thought much about - it sounds very cool. At least the Thumbnail creation component could be worked out fairly easily. Its the loading of the PDF's themselves that still concerns me. Does anyone know whether there is a way to get progress info from a PDF loading into a view - percentage/bytes loaded for example?


Synchronizing the PDF, it's associated thumbnail and the list in the Table View, appears to be my main problem with regard to threading. An Indexing scheme of some sort does appear to be the best solution to prevent the crashes I'm currently experiencing.

Cheers

Karl

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to