次のコードを書いています。
#import <objc/objc.h>
#import <Foundation/Foundation.h>
@interface myT :NSObject
-(void) startT;
-(void) tfun;
@end
@implementation myT
-(void) tfun
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSLog (@"Inside thread Function .. ");
[pool drain];
}
-(void) startT
{
[NSThread detachNewThreadSelector:@selector(tfun) toTarget:self withObject:nil ];
}
@end
int main ( int argc, char ** argv)
{
myT *t = [[myT alloc] init];
[t startT];
return 0;
}
コンパイルされ、実行時エラーが発生します。私は何を間違っていますか?私はpthreadに精通しています。スレッドが完了するまでどのように待つことができますか。つまり、pthread_wait のようなものです。