
sleep和wait的区别:
1、sleep的意思是:睡,睡觉,睡眠。
2、wait的意思是:等候,推迟,延缓等待,耽搁,伺则碧候用餐。
拓展资料
sleep的用法
1、They were exhausted from lack of sleep
由于缺乏睡眠,他们非常疲惫。
2、扮盯启During the car journey, the baby slept
坐车来的路上,宝宝睡着了。
3、I think he may be ready for a sleep soon.
我想他也许很快就要睡一觉了。
4、I can't get to sleep with all that singing.
那些歌声搅得我无法入睡厅如。
5、I didn't lose too much sleep over that investigation.
我并不太担心那个调查。
wait
1、I walk to a street corner and wait for the school bus
我走到街角等校车。
2、There'll be a car waiting for you
会有辆汽车等你。
3、I want to talk to you, but it can wait
我想和你谈谈,但可以晚点再说。
4、If you think this all sounds very exciting, just wait until you read the book
如果你觉得所有这些听起来令人兴奋,那就等着去读这本书吧。
5、'Wait a minute!' he broke in. 'This is not giving her a fair hearing!'
“等一下,”他插嘴说,“这没有给她一个公平的解释机会!”
sleep()方法导致了程序暂停执行指定的时间,让出cpu该其他线程,但是他的监控状态依然保持和睁者,当指定的时间到了又会自动恢复运行状态。在调用sleep()方法的过程中,线程不会释放对象锁。因好迅此不会影响唤袜岁性能。
“sleep函数的作用是:线程告诉 *** 作系统,在second秒的时正返间内,自身链吵不需要调度(直接棚清侍睡觉了),不要给自身分配时间片了。 使cpu更容易易主(因为放弃时间片了,所以就易主了
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)