Thread.Sleep()vs Thread.SpinWait() [英] Thread.Sleep() vs Thread.SpinWait()
本文介绍了Thread.Sleep()vs Thread.SpinWait()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在互联网上寻找答案,以便更好地解释它们的工作原理和方式:
* Thread.Sleep()
* Thread.SpinWiat()
我想知道每一个的好处/劣势是什么,差异(如果有的话)可能是一个例子什么时候会它们被使用?
I have been searching for answers on the internet for a better explanations of what are and how they work:
* Thread.Sleep()
* Thread.SpinWiat()
I would like to know what is the benefit/disadvantage for each one, differences if any and perhaps an example when would they be used?
推荐答案
Thread.Sleep():
.NET中的睡眠()功能 [ ^ ]
http://www.dotnetperls.com/sleep [ ^ ]
https://www.simple-talk.com/dotnet/asp.net/i mplementing-waiting-pages-in-asp.net/ [ ^ ]
Thread.SpinWiat() :
http://www.dotnetperls.com/spinwait [ ^ ]
http://stackoverflow.com/questions/1091135/whats-the- thread-spinwait方法的目的 [ ^ ]
SpinWait vs睡眠等待。哪一个使用?
http://stackoverflow.com/questions/9719003/spinwait-vs-sleep-waiting-which-one-to-use [ ^ ]
Thread.Sleep() :
The Sleep() Function in .NET[^]
http://www.dotnetperls.com/sleep[^]
https://www.simple-talk.com/dotnet/asp.net/implementing-waiting-pages-in-asp.net/[^]
Thread.SpinWiat() :
http://www.dotnetperls.com/spinwait[^]
http://stackoverflow.com/questions/1091135/whats-the-purpose-of-thread-spinwait-method[^]
SpinWait vs Sleep waiting. Which one to use?
http://stackoverflow.com/questions/9719003/spinwait-vs-sleep-waiting-which-one-to-use[^]
这篇关于Thread.Sleep()vs Thread.SpinWait()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文