iOS如何获取后台调度队列完成状态

时间:2016-08-09 10:42:23

标签: ios

我创建了像这样的A Queue

dispatch_queue_t myBackgroundQueue;
  myBackgroundQueue = dispatch_queue_create("com.google.task", NULL);


  dispatch_async(myBackgroundQueue, ^(void) {
  });

这将在按钮点击时调用,我想知道当前后台运行队列。谢谢

1 个答案:

答案 0 :(得分:0)

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    BOOL ok = // some result

    // do some long running processing here

    // Check that there was not a nil handler passed.
    if( completionHandler )
    {
        // This assumes ARC. If no ARC, copy and autorelease the Block.
        [completionHandler performSelector:@selector(rmaddy_callBlockWithBOOL:)
                                  onThread:origThread
                                withObject:@(ok)    // or [NSNumber numberWithBool:ok]
                             waitUntilDone:NO];
    }
    });
});