0

My program is running by gcd.

-(void) viewdidLoad {

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH,0),
    ^ {
        for(int i=0; i<screenshotNum ; i++)
        {
            NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];  

            NSString * url=[detailItem.mScreenshot objectAtIndex:i];

            NSDictionary *args=[NSDictionary dictionaryWithObjectsAndKeys:
                                [NSNumber numberWithInt:i], @"screenNum",
                                [NSString stringWithString:url],@"url",
                                nil];

                               [self loadImageScreenshot:args];

            [pool release]; 
        }
    });
}

problem is still running when I dismissModalViewController.

I want to quit these back threads when I touch back button.

-(void) BackButtonPressed:(id)sender
{
    [self dismissModalViewControllerAnimated:YES];
}

How do I add codes?

Rob
  • 415,655
  • 72
  • 787
  • 1,044
SeoTaiJi
  • 141
  • 1
  • 9
  • Might help you ... http://stackoverflow.com/questions/5449469/can-you-use-cancel-iscancelled-with-gcd-dispatch-async – bryanmac May 17 '12 at 06:08

1 Answers1

0

There is no defined API to cancel operation with Dispatch Queues, however you can define certain point of termination if you need.

Check out this thread for detailed description - kill items in a dispatch_async queue in iOS

Community
  • 1
  • 1
rishi
  • 11,779
  • 4
  • 40
  • 59