0

I have a class which inherits NSThread:

header:

@interface MyService : NSThread {
  -(void)startMe;
}

implementation:

@implementation MyService
  -(void)startMe {
   [self start];
  }
@end

In another class, I get a instance of MySerivce:

MyService *service = [self getMyService];
[service startMe];
...

// here, what is the best practice to gracefully stop the service thread ?

How can I gracefully stop service thread after it has been started?

Leem.fin
  • 40,781
  • 83
  • 202
  • 354
  • Will you delete this question when someone answers? – Droppy Jun 14 '16 at 14:23
  • 1
    Did you check out other SO answers? http://stackoverflow.com/questions/15413955/how-to-cancel-exit-stop-execution-of-thread-object-or-thread-running-in-backgrou – Dominic Jun 14 '16 at 14:27
  • @Droppy , I delete my previous question because: 1, no one answered it, 2. I noticed it is not a valid question since the code snippet I posted is running fine though it was not previously for some reason which I don't know. I hope this answers your question. – Leem.fin Jun 14 '16 at 14:27
  • I answered it. And then you deleted it. – Droppy Jun 14 '16 at 14:30
  • @Droppy , I don't want to argue on that, but if there is an answer, and I press "delete" button, there would be a pop up saying something "there is an answer, you can't delete it". I didn't encounter that. The only thing I have seen was a comment asked me "why you inherits NSThread?". I probably missed your comment when delete it. – Leem.fin Jun 14 '16 at 14:35

0 Answers0