Re: Threading - How its done?
Re: Threading - How its done?
- Subject: Re: Threading - How its done?
- From: Michael Vannorsdel <email@hidden>
- Date: Thu, 8 May 2008 00:20:26 -0600
What is sounds like you're saying is something like:
const char * str = "Hello";
//thread 1
char bufferA[20]:
strncpy(bufferA, str, sizeof(bufferA));
//thread 2
char bufferB[20]:
strncpy(bufferB, str, sizeof(bufferB));
is unsafe and needs a lock?
On May 7, 2008, at 11:26 PM, Chris Hanson wrote:
I don't know what gave you this idea, but it's simply not correct in
the general case.
Whether you're accessing or changing shared data, you need to be
using proper synchronization primitives. In special circumstances
you can use things like atomic operations or barrier primitives, but
in general if you're going to share data you must synchronize access
to it.
_______________________________________________
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