Re: NSOperationQueue and for-loop
Re: NSOperationQueue and for-loop
- Subject: Re: NSOperationQueue and for-loop
- From: Koen van der Drift <email@hidden>
- Date: Wed, 03 Oct 2012 09:03:05 -0400
On Wed, Oct 3, 2012 at 8:48 AM, Mike Abdullah <email@hidden> wrote:
>
Regardless, your posted code is going to blow up sooner or later.
NSMutableArray is not safe to modify from more than a single thread at
a time. If two of your worker blocks happen to finish at the same time
and call -addObject: together, nasty things will happen.
>
Good point, thanks. So are there any workarounds for that? I'm sure
this pattern (doing lots of calculations concurrently, and store the
results in a common object for later), is used in other situations as
well.
- Koen.
_______________________________________________
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