• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Threading and NSViews
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Question on thread communication (From: Karim Morsy <email@hidden>)
 >Re: Question on thread communication (From: Kaelin Colclasure <email@hidden>)
 >Re: Question on thread communication (From: Kaelin Colclasure <email@hidden>)
 >Threading and NSViews (From: Karim Morsy <email@hidden>)

  • Prev by Date: Re: Reverse engineering
  • Next by Date: NSDictionary, NSTableView and binding
  • Previous by thread: Re: Threading and NSViews
  • Next by thread: Installer
  • Index(es):
    • Date
    • Thread