Re: Threading and NSViews
Re: Threading and NSViews
- Subject: Re: Threading and NSViews
- From: j o a r <email@hidden>
- Date: Mon, 20 Mar 2006 23:03:00 +0100
On 20 mar 2006, at 22.28, Karim Morsy wrote:
so far I've been drawing a view on the main thread and redrawn it
with a timer every 0.02 seconds.
I hope that you're only updating your drawing when your model has
updated? So that you're not just drawing regardless of if you have
new data to draw or not. That would be bad. Pooling updates to
prevent too many drawings per second is cool of course.
so far, most of the time this has been working fine, except for
some tiny mis-drawings that sometimes occur (from which I assume
that I'm missing something here).
That's probably a safe assumption.
I've read several articles and docs about multithreading in cocoa
and it's said one has to be really cautious when drawing on
seperate threads.
Have you read this one?
<http://developer.apple.com/documentation/Cocoa/Conceptual/
Multithreading/articles/CocoaSafety.html>
Among other things, you're not allowed to call "setNeedsDisplay:"
from a secondary thread.
Besides that you should be fine as long as you're really, really,
careful about what you do in your "updateView:" method.
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden