开发者

usleep() in objective c code

In my objective c code I am using c and c++ libraries. Inside that there is a usleep(20); method used and I am keep on getting a warning "implicit declaration of function 'usleep'". Is it ok to keep this in the code? Can this code chunk can cause to app reject开发者_如何学Cion in App Store?

Thank you.


That’s just a compiler warning. You can keep on using the call, just add this to the top of your code:

#import <unistd.h>

As far as App Store goes it’s perfectly safe.


usleep() is a relative of sleep() and nanosleep(). You can see the pattern; the first takes a parameter in microseconds, the second in seconds, and the third in nanoseconds. Using these methods will put the thread that it was called from to sleep (pause) for the amount of time specified. This is completely legal to use, and I guarantee that your app will not be rejected for its use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜