I think I would like to try drawing my app's content in a secondary thread to see if it will improve performance and teh snappy™. Docs on this topic are a bit sketchy, and I've not been able to put my finger on any sample code that is pertinent.

The docs mention bracketing all drawing between lockFocusIfCanDraw: and unlockFocus, which sounds OK, but it's when I should be creating my thread that has me puzzled. Should I spawn a new thread for each update, or should I have a worker thread that just keeps going, repeatedly doing any needed drawing? If the former, where should I spawn the thread? If the latter, how will it know when something needs to be drawn (and if nothing, can I make it sleep until there is)? Do I need one thread per view, or can a single thread handled different views of the same class (that do share the same drawing code otherwise).

I realise these questions must sound rather fundamental, but nothing in the Cocoa Drawing Guide or Thread Guide really addresses them. I have used threads before to perform tasks not involving drawing, so I'm not completely unfamiliar with them, but I haven't tried drawing on a secondary thread before.

Any pointers (to sample code, 3rd party code, or just tips) gratefully received - thanks in advance.


G._______________________________________________

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