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 */
}
/* ... */
}
精彩评论