开发者

a correct way to programming NSOperation subclass cancel

Hi i'm using m开发者_JAVA技巧ysql connection from 5.5. version mysqllibclient. Is it a way to make something, to stop mysql query if i seen that isCancelled is start to yes? Timers doesn't work stable in nsoperation, i don't know why (please see my question about nstimer problem, it is not answered).


// you have two immediate options:

// 1) override cancel:
- (void)cancel {
    [super cancel];
    /* get out */
}

// 2) test isCancelled
- (void)main {
    /* ... */
    if (self.isCancelled) {
      /* get out */
    }
    else {
      /* continue working */
    }
    /* ... */
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜