On Mar 9, 2012, at 00:30 , CoGe - Tamas Nagy wrote:

> Thanks Quiencey to pointing this out, however, what you suggest instead of 
> the current implementation? What I use for this class is putting and/or 
> update  objects into it from different threads, then access it from an other 
> (reader) thread (via objectAtIndex: and by enumarating).

It depends on how often the array gets updated and how big it is. One simple 
approach is to serialize all access to the array through the main thread (e.g. 
via 'performSelectorOnMainThread'), but you'd have to enumerate a 
(serially-retrieved) copy of the array each time.

The most flexible solution might be to use NSOperationQueue (or GCD) to set up 
some kind of producer/consumer model. But it still depends on the details of 
what you're trying to do.


_______________________________________________

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