• 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: drawing in a separate thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: drawing in a separate thread


  • Subject: Re: drawing in a separate thread
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Fri, 2 May 2008 18:04:02 +0200


Le 2 mai 08 à 17:27, Jens Alfke a écrit :


On 2 May '08, at 4:20 AM, Jean-Daniel Dupas wrote:

You can have a look at DistributedObject. I think you can publish a drawer object in your drawing thread and then, just call draw fro your main thread.

DO might be overkill for this scenario. The background thread really just needs to run a while() loop that waits on a condition-lock, then draws. The main thread's -drawRect: method just sets the condition on the lock to trigger the background thread.

You're right for the.



If more information needs to be passed to the thread, you can use a producer/consumer queue, but unfortunately Foundation doesn't come with one of those built-in; there must be source code for one lying around, though.


—Jens

You're too. The Cocoa Threading Programmming Guide shows a way to implements producer/consumer using NSConditonalLock.
(http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/chapter_5_section_7.html )




_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >drawing in a separate thread (From: Graham Cox <email@hidden>)
 >Re: drawing in a separate thread (From: "Kyle Sluder" <email@hidden>)
 >Re: drawing in a separate thread (From: Graham Cox <email@hidden>)
 >Re: drawing in a separate thread (From: Jean-Daniel Dupas <email@hidden>)
 >Re: drawing in a separate thread (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: drawing in a separate thread
  • Next by Date: Re: Unit Test error XCode 3.1 (Beta)
  • Previous by thread: Re: drawing in a separate thread
  • Next by thread: Re: drawing in a separate thread
  • Index(es):
    • Date
    • Thread