>> I am migrating my code to use GCD blocks instead of NSOperations.
>
> Why?

I should have said, I'm writing a new app and I am migrating my
knowledge of implementing multi-threading from NSOperation to GCD :)

(And I should say, I'm beginning to like the easiness of GCD, even
though I was initially reluctant to use blocks, because they seem
harder to read, less encapsulated and easier to make scope mistakes.)

>> But this seems a bit clunky (compared to the elegance of GCD code),
>
> It's pretty much your only option.  GCD doesn't have a notion of canceling a 
> task, so you can only set a flag and check it.

Thanks, now I know.

> If at any point it evaluates to true, then you know somebody has set it or is 
> in the process of setting it, which means it really is supposed to be true.  
> In theory, yes, the code which is setting it may not have completed, but you 
> don't care.

I undersand that, but I just wanted to be a purist :) Well, I will do
as Charles suggested: I will declare the property as atomic and
synthesize it.

Thanks to everyone!
_______________________________________________

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

This email sent to [email protected]

Reply via email to