Linux 下sleep()函数

调试程序发现起了一个子线程后,主线程上的sleep不生效了,看到这才明白...

— Function: unsigned int sleep (unsigned int seconds)

The sleep function waits for seconds or until a signal is delivered, whichever happens first.

If sleep function returns because the requested interval is over, it returns a value of zero. If it returns because of delivery of a signal, its return value is the remaining time in the sleep interval.

参考:http://www.gnu.org/software/libc/manual/html_node/Sleeping.html
原文地址:https://www.cnblogs.com/good90/p/3209663.html