2010-05-24
■ [NSThread]NSThreadを使ったスレッド処理 
スレッドを生成するには detachNewThreadSelector を使う。
実行されるメソッド自体が自動解放プールの管理を行う必要がある。
[NSThread detachNewThreadSelector:@selector(hogehoge) toTarget:self withObject:self]; - (void)hogehoge { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; // 処理 [pool release]; [NSThread exit]; // 途中でスレッドを終了する }
コメント