2010-04-26 6 views
1

detachNewThreadSelector:toTarget:withObject:을 사용하여 NSThread 개체를 만들고 실행한다고 가정 해 보겠습니다. 스레드에 의해 실행하는 방법은 다음과 같습니다 그때가 실행중인 동안 수영장이 출시되기 전에, 스레드를 죽일 cancel 방법을 사용할 수 있습니다NSThread 및 메모리 관리

- (void)search { 
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 

    // perform a lengthy search here. 

    [pool release]; 
} 

. NSAutoreleasePool 객체는 어떻게됩니까? 누출 될 것 같네요, 그렇죠?

답변

2

-(void)cancel 취소를 강요하지 않으며 단순히 요청합니다. -(void)search이 완료 될 때까지 실행됩니다. 자세한 내용은 "Responding to the Cancel Command"을 읽어보십시오.