Nick,

In your secondary you can use dispatch_async or dispatch_sync to schedule a 
block of code to execute on the main thread. Below is a simple example:

dispatch_async(dispatch_get_main_queue(), ^{
      // put your code to modify mutable array here
  });


I hope this helps.

Thanks,
Abdul

On Aug 6, 2013, at 11:39 AM, Nick Rogers 
<[email protected]<mailto:[email protected]>> wrote:

Hi,

Please look at the following situations:

1. Created a mutable array in main thread, can I read its values in a secondary 
thread safely, while no other thread is modifying this mutable array?

2. I need to add objects to this mutable array from a secondary thread, and no 
other thread is modifying it. Can I simply add an object like, [array 
addObject:obj]; or if this is wrong how to achieve the same? The object to add 
is mostly NSString or NSNumber or a mutable dictionary of NSString and NSNumber.

Please help.

Best,
Nick


_______________________________________________

Cocoa-dev mailing list 
([email protected]<mailto:[email protected]>)

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/asowayan%40vectorworks.net

This email sent to [email protected]<mailto:[email protected]>

_______________________________________________

Cocoa-dev mailing list ([email protected])

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

This email sent to [email protected]

Reply via email to