优雅地从另一个类停止线程

时间:2016-06-14 14:20:23

标签: ios objective-c multithreading nsthread

我有一个继承NSThread的小组:

头:

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

实现:

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

在另一个课程中,我得到了MySerivce的实例:

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

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

如何在服务线程启动后优雅地停止服务线程?

0 个答案:

没有答案