Thread.Sleep问题 [英] Thread.Sleep question

查看:110
本文介绍了Thread.Sleep问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自Doc:


Thread.Sleep(Int32)暂停当前线程达到指定时间。


Thread.Sleep( TimeSpan)阻止当前线程达到指定时间。


这些具有相同的效果。也就是说,做块字样。和暂停

表示相同或不同的东西。


提前致谢

From the Doc:

Thread.Sleep (Int32) Suspends the current thread for a specified time.

Thread.Sleep (TimeSpan) Blocks the current thread for a specified time.

Do these have the same effect. That is, do the words "Blocks" and Suspends"
mean the same or different things.

Thanks in advance

推荐答案

这些是相同的。


-

Richard Grier,MVP

Hard&软件

Visual Basic程序员串行通信指南的作者,第四版

版,

ISBN 1-890422-28-2( 391页,包括CD-ROM)。 2004年7月,修订3月

2006.

www.hardandsoftware.net 了解详情和联系方式。
These are the same.

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer''s Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.


谢谢


他们是否更好地使用

直到VB.Now EndTime


Application.DoEvents()


循环

Dick Grier < dick_grierNOSPAM @ .msn.comwrote in message

news:ed ************** @ TK2MSFTNGP04.phx.gbl ...
Thanks

Are they better to use then
Do Until VB.Now EndTime

Application.DoEvents()

Loop
"Dick Grier" <dick_grierNOSPAM@.msn.comwrote in message
news:ed**************@TK2MSFTNGP04.phx.gbl...

这些是相同的。


-

Richard Grier,MVP

Hard &安培;软件

Visual Basic程序员串行通信指南的作者,第四版

版,

ISBN 1-890422-28-2( 391页,包括CD-ROM)。 2004年7月,修订3月

2006.

www.hardandsoftware.net 了解详情和联系方式。
These are the same.

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer''s Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.



Franky写道:
Franky wrote:

他们最好使用
Are they better to use then


Do VB.Now EndTime

Application.DoEvents ()

循环
Do Until VB.Now EndTime
Application.DoEvents()
Loop



是!!


以上将推动CPU使用率你的机器通过屋顶,

即使它仍然允许其他进程运行。


Thread.Sleep()实际上挂起当前线程,所以它使用

[虚拟]没有CPU。


问候,

Phill W.

Yes!!

The above will drive the CPU usage of your machine through the roof,
even though it still allows other processes to run.

Thread.Sleep() actually suspends the current thread, so it uses
[virtually] no CPU.

Regards,
Phill W.

这篇关于Thread.Sleep问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆