Linux 下sleep()函数

时间:2021-07-19 16:48:24

调试程序发现起了一个子线程后,主线程上的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