在macos 或 ios sleep 与sleepForTime

2020-03-25  本文已影响0人  雨后天_

sleep 传的参数是unsigned int ,单位秒,不要传小于1的数。有时候会出现问题。 要传整数。

sleepForTimeInterval 传的参数是double ,单位秒,所以可以用小数。10ms 传0.01,10s传10。

建议睡眠秒数小于1时,用sleepForTimeInterval代替sleep

上一篇 下一篇

猜你喜欢

热点阅读