在执行中创建暂停 [英] Creating a Pause in Execution
问题描述
在执行中创建非阻塞暂停的好方法是什么?
我是否需要使用某种计时器,或者是否有更好的计时器? />
方式?
int pauseTime = 2000;
System.Threading.Thread.Sleep( pauseTime);
" C#Learner" < CS **** @ learner.here>在消息中写道
news:8b ******************************** @ 4ax.com ...在执行中创建非阻塞暂停的好方法是什么?
我是否需要使用某种计时器,或者在那里一个更好的方式?
" Vadym Stetsyak" < PD **** @ ukr.net>写道:
" C#Learner" < CS **** @ learner.here>在消息中写道
新闻:8b ******************************** @ 4ax.com .. < blockquote class =post_quotes>在执行中创建非阻塞暂停的好方法是什么?
我是否需要使用某种计时器,或者是否有更好的计时器? />方式?
int pauseTime = 2000;
System.Threading.Thread.Sleep(pauseTime);
嗨Vadym,感谢您的快速回复。
问题在于 - 它会阻止当前(GUI)线程。我是
在没有阻止当前
线程的情况下寻找可以做到这一点的事情。
问候
C#Learner< cs **** @ learner.here>写道:问题是 - 它阻止当前(GUI)线程。我正在寻找能够做到这一点而不会阻挡当前线程的东西。
你想要暂停*的确切*然后?如果它是另一个线程,
只是让其他线程睡觉。
-
Jon Skeet - < ; sk *** @ pobox.com>
http://www.pobox .com / ~siget
如果回复小组,请不要给我发邮件
What''s a nice way to create a non-blocking pause in execution?
Will I need to use some kind of timer for this, or is there a nicer
way?
int pauseTime = 2000;
System.Threading.Thread.Sleep(pauseTime);
"C# Learner" <cs****@learner.here> wrote in message
news:8b********************************@4ax.com...What''s a nice way to create a non-blocking pause in execution?
Will I need to use some kind of timer for this, or is there a nicer
way?
"Vadym Stetsyak" <pd****@ukr.net> wrote:
"C# Learner" <cs****@learner.here> wrote in message
news:8b********************************@4ax.com.. .What''s a nice way to create a non-blocking pause in execution?
Will I need to use some kind of timer for this, or is there a nicer
way?
int pauseTime = 2000;
System.Threading.Thread.Sleep(pauseTime);
Hi Vadym, thanks for your quick response.
The problem with that is - it blocks the current (GUI) thread. I''m
looking for something that will do this without blocking the current
thread.
Regards
C# Learner <cs****@learner.here> wrote:The problem with that is - it blocks the current (GUI) thread. I''m
looking for something that will do this without blocking the current
thread.
What *exactly* are you trying to pause then? If it''s another thread,
just make that other thread sleep instead.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
这篇关于在执行中创建暂停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!