On Jul 29, 2013, at 2:34 AM, Oleg Krupnov <oleg.krup...@gmail.com> wrote:
> Is there a way to exit a GCD thread? You can exit a GCD thread with something like this. - (void)invalidateQueue { _isQueueCanceled = YES; dispatch_sync(_queue, ^{}); } - (void)submitWorkToBeDone { dispatch_async(_queue, ^{ for ( ... ) { if (_isQueueCanceled == YES) { break; } else { // do work } } }); } When invalidateQueue returns the thread has been canceled. Richard Somers _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com