Thanks for the suggestion, its really appreciated! I'll do some tests - actually the GCD way seems to be the forward.
Anyway, maybe the array contains non-thread safe objects (QCRenderers) - object that should not be bounce between different threads. But with those, I think I can't use GCD, because GCD cannot guarantie operations will perform on the exact same thread - or at least in my understanding. On Mar 9, 2012, at 9:51 AM, Quincey Morris wrote: > 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]
