views:

73

answers:

3

hi friends, I m creating a Tic tac toe game, in that after click made by user automatically the cpu will respond. I want the cpu response after 0.50 seconds, the sleep() function takes too many time, i don't want that much time, is there any other way to do so???

+1  A: 

usleep(500000)

Marcelo Cantos
ok buddy... perfect, thanks...
iPhone Fun
Thanks buddy m this is what i was needed.....
iPhone Fun
Actually, it probably isn't. If you call this function on the main thread, the UI will lock up for 0.5 seconds. If you want the UI to remain responsive mihirpmehta's answer is better.
JeremyP
+5  A: 

use

[self performSelector:@selector(FunctionName) withObject:nil afterDelay:0.5 ];
mihirpmehta
A: 

use sleep property and give (more milliseconds)

KareemSaad