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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to