开发者

a correct way to programming NSOperation subclass cancel

开发者 https://www.devze.com 2023-02-18 16:17 出处:网络
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?

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

精彩评论

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