Re: How to cancel an asynchronous GCD block?
Re: How to cancel an asynchronous GCD block?
- Subject: Re: How to cancel an asynchronous GCD block?
- From: Charles Srstka <email@hidden>
- Date: Fri, 01 Jul 2011 03:14:36 -0500
On Jul 1, 2011, at 2:54 AM, Oleg Krupnov wrote:
> But this seems a bit clunky (compared to the elegance of GCD code),
> and also I'm not sure if it will be thread-safe to set m_isCancelled
> from the main thread, while the async block may be racing to query it
> (though it should be fine, setting a boolean variable should be
> atomic).
>
> Is there a better solution?
You can declare the boolean as an atomic property and synthesize it. Then, it will be sure to be atomic, no matter what.
Charles_______________________________________________
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