Timeout a NSThread after a certain amount of time

Posted by Zen_silence on Stack Overflow See other posts from Stack Overflow or by Zen_silence
Published on 2010-03-18T21:43:06Z Indexed on 2010/03/18 21:51 UTC
Read the original article Hit count: 556

Filed under:
|
|
|
|

Hello,

I have a NSThread that i would like to timeout after a certain amount of time.

[NSThread detachNewThreadSelector:@selector(someFuntion) toTarget:self withObject:nil];

- (void) someFunction {
   //Some calculation that might take a long time.
   //if it takes more then 10 seconds i want it to end and display a error message
}

Any help you can provide on this would be greatly appreciated.

Thanks,

Zen_silence

© Stack Overflow or respective owner

Related posts about nsthread

Related posts about iphone