开发者

When to dispatch_release()?

开发者 https://www.devze.com 2023-02-07 18:02 出处:网络
I\'m fairly new to GCD and was trying to find an answer to this. Assuming I have the following code: dis开发者_运维技巧patch_queue_t queue = dispatch_queue_create(\"queue\", NULL);

I'm fairly new to GCD and was trying to find an answer to this. Assuming I have the following code:

dis开发者_运维技巧patch_queue_t queue = dispatch_queue_create("queue", NULL);
dispatch_async(queue, ^{
    // do some stuff
});

Where in the code should I release the queue? Inside or outside the block?


Outside the block. I'm fairly certain you don't have to wait for the async block to finish as GCD will retain the queue.

0

精彩评论

暂无评论...
验证码 换一张
取 消