• 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: Accessing array in thread safe way
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Accessing array in thread safe way (From: "Jan E. Schotsman" <email@hidden>)

  • Prev by Date: [MEET] CocoaHeadsNYC Thursday night (tonight)
  • Next by Date: Re: Finding object array index when iterating through array
  • Previous by thread: Re: Accessing array in thread safe way
  • Next by thread: Finding object array index when iterating through array
  • Index(es):
    • Date
    • Thread