• 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: Douglas Davidson <email@hidden>
  • Date: Mon, 8 Sep 2003 11:59:56 -0700

On Monday, September 8, 2003, at 11:43 AM, Eric Scharff wrote:

Is this the right way to write the getter?

-(Result *)result {
Result *r;

[myLock lock];
r = result;
[myLock unlock];
return r;
}

Is this over-paranoid? can one assume the assignment is atomic?

I believe this is unnecessary; but in any event, if your main thread accesses the result after being notified by the worker thread that it is ready, and if the worker thread does not touch the result thereafter, then you should have no problems.

Douglas Davidson
_______________________________________________
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.

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

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