Re: Techniques for thread communication
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.