Skip to content

Instantly share code, notes, and snippets.

@edom18
Created April 1, 2014 16:23
Show Gist options
  • Select an option

  • Save edom18/9917611 to your computer and use it in GitHub Desktop.

Select an option

Save edom18/9917611 to your computer and use it in GitHub Desktop.
[Objective-C] GCDについての備忘録 ref: http://qiita.com/edo_m18/items/2f8c6bde4492ef116ed0
dispatch_queue_t queue = dispatch_queue_create("com.hoge.queue", [attribute]);
// 3秒後に処理を実行
dispatch_time_t time = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC));
dispatch_after(time, dispatch_get_main_queue(), ^{
// do something.
});
size_t iterations = 10;
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITIY_DEFAULT, 0);
dispatch_apply(iterations, queue, ^(size_t i) {
NSLog(@"Current i: %lu", i);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment