• 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: Techniques for thread communication
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Techniques for thread communication


  • Subject: Re: Techniques for thread communication
  • From: Cameron Hayne <email@hidden>
  • Date: Tue, 09 Sep 2003 00:51:50 -0400

On 8/9/03 1:56 PM, "Eric Scharff" <email@hidden> wrote:

> Set up an NSTimer on the main thread, that every N seconds
> queries the worker thread for the best result so far, and
> displays it. Since there is always a "best so far", this method
> is always meaningful.

I have a sample project "ImageCalc" that does something analogous to what
you are doing. I use a timer to regulate the view updates in the manner you
suggested above. I use two NSLock's to control access to the shared
(calculated) data. (I need two locks since each of the two threads both
reads and writes the data and I don't want any reading while the writing is
in-progress or writing while the reading is in-progress.)
You can download my sample code at:
http://hayne.net/MacDev/ImageCalc/

--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Techniques for thread communication (From: Eric Scharff <email@hidden>)

  • Prev by Date: Re: MiscKit
  • Next by Date: background image for NSTextView
  • Previous by thread: Re: Techniques for thread communication
  • Next by thread: Re: Techniques for thread communication
  • Index(es):
    • Date
    • Thread