使用及关闭线程
-(void)startRtsp{ // [self performSelectorInBackground:@selector(lanzado) withObject:nil]; thread = [[NSThread alloc]initWithTarget:self selector:@selector(lanzado) object:nil]; [thread start]; }-(void)stopRtsp{ [session teardown]; [thread cancel]; if ([[NSThread currentThread] isCancelled]) { //clean up [NSThread exit]; } }