开发者

memory management for deeper background work

Currently i do some job in class:

[userController startRegistrationForAllObjectsInFutureArrayForTableView:nil];

this is a function:

-开发者_StackOverflow中文版(void) startRegistrationForAllObjectsInFutureArrayForTableView:(id)tableView;
{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^(void) {
     ... some job here
});

So, job is going to background. But i still need release class after all job will completed. So what is a way to solve it? Currently i do as here:

    [userController retain];
    [userController startRegistrationForAllObjectsInFutureArrayForTableView:nil];
}
[userController release];
[pool drain], pool = nil;

But i'm not sure if it work correct and what happened when autorelease pool is absent. Tnx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜