[objective-c]GCDを使った非同期処理

GCDを使った非同期処理
GCD:Grand Central Dispatch

dispatch_queue_t main=dispatch_get_main_queue();
dispatch_queue_t sub=dispatch_queue_create("net.ktyr.sample", NULL);
dispatch_async(sub, ^{
    //何か重たい処理
    UIImage*image=[UIImage imageNamed:@"thankyou.png"];
    dispatch_async(main, ^{
        //重たい処理が終わったとき
        [myImageView setImage:image];
    });
});
dispatch_release(sub);