Skip navigation.
 
mldrawing in a separate thread
FROM : Graham Cox
DATE : Fri May 02 09:13:01 2008

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 (<email_removed>)

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/<email_removed>

This email sent to <email_removed>

Related mailsAuthorDate
mldrawing in a separate thread Graham Cox May 2, 09:13
mlRe: drawing in a separate thread Kyle Sluder May 2, 10:13
mlRe: drawing in a separate thread Graham Cox May 2, 13:07
mlRe: drawing in a separate thread Jean-Daniel Dupas May 2, 13:20
mlRe: drawing in a separate thread Jens Alfke May 2, 17:27
mlRe: drawing in a separate thread Graham Cox May 2, 17:30
mlRe: drawing in a separate thread Jean-Daniel Dupas May 2, 18:04
mlRe: drawing in a separate thread Duncan May 3, 05:40
mlRe: drawing in a separate thread Graham Cox May 3, 06:51
mlRe: drawing in a separate thread Duncan May 3, 13:36
mlRe: drawing in a separate thread Jean-Daniel Dupas May 3, 13:57
mlRe: drawing in a separate thread Graham Cox May 3, 14:52
mlRe: drawing in a separate thread Jean-Daniel Dupas May 3, 15:22
mlRe: drawing in a separate thread Graham Cox May 3, 15:30
mlRe: drawing in a separate thread Ricky Sharp May 3, 15:44
mlRe: drawing in a separate thread Jean-Daniel Dupas May 3, 15:55
mlRe: drawing in a separate thread Graham Cox May 3, 16:11