self.thread = [[NSThread alloc] initWithTarget:self selector:@selector(run:) object:@{@"name":@"mmm"}];
[self.threadstart];
- (void)run:(id)object
{
@autoreleasepool {
[[NSThread currentThread] setName:@"ForeverThread"];
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
[runLoop addPort:[NSMachPort port] forMode:NSDefaultRunLoopMode];
[runLoop run];
}
}
[self performSelector:@selector(runToThread:) onThread:self.thread withObject:@"xxxxx" waitUntilDone:NO];
- (void)runToThread:(id)object
{
NSLog(@"-----name:%@--", [[NSThread currentThread] name]);
NSLog(@"----11------%@--------", object);
[NSThread sleepForTimeInterval:3];
NSLog(@"-----222-----%@--------", object);
}