Re: Accessing array in thread safe way
Re: Accessing array in thread safe way
- Subject: Re: Accessing array in thread safe way
- From: Brian Lambert <email@hidden>
- Date: Tue, 06 Mar 2012 14:28:07 -0800
No.
Assuming the property you describe is declared something like this:
@property (strong, atomic) NSMutableArray * myArray;
Then what's atomic is getting and setting the entire array. That is
[project setMyArray:[[NSMutableArray alloc] init]]; would be atomic.
Once a caller obtains the array by calling:
NSMutableArray * theArray = [project myArray];
And starts messing with it:
[theArray someMethod];
The array contents are not protected.
On Tue, Mar 6, 2012 at 11:51 AM, Jan E. Schotsman <email@hidden> wrote:
> Hello,
>
> I have an array of progress values (number objects) for subprojects, from
> which I calculate the overall progress .
> The array is an atomic property of the project class.
>
> Is it safe to access this array from multiple threads, using methods like
> objectAtIndex and replaceObjectAtIndex?
>
> Jan E.
> ______________________________**_________________
>
> 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<http://lists.apple.com>
>
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/**mailman/options/cocoa-dev/**
>
> This email sent to email@hidden
>
_______________________________________________
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