英语翻译There are quite a few issues here:1) You can leave this
来源:学生作业帮 编辑:大师作文网作业帮 分类:英语作业 时间:2024/11/12 17:47:28
英语翻译
There are quite a few issues here:
1) You can leave this in the main thread.Unless the main thread is going to be doing some work of its own,there is no reason to have a secondary thread for the loop.
2) Since you have to update some global state "almost continuously",you'll need to have processing that's occurring very regularly.This eliminates blocking on events.
My recommendation would be to move your while(..) loop into your main thread - you don't need the second one.
You could then have it update your global state,and do any event processing from the queue.In order to prevent the huge CPU usage,have the main thread sleep for a short interval every time.It could look like:
while(!exitCondition)
{
UpdateGlobalState();
ProcessEventQueue();
System.Threading.Thread.Sleep(10); // Sleep for a short period here,to avoid huge,unnecessary CPU usage
}
There are quite a few issues here:
1) You can leave this in the main thread.Unless the main thread is going to be doing some work of its own,there is no reason to have a secondary thread for the loop.
2) Since you have to update some global state "almost continuously",you'll need to have processing that's occurring very regularly.This eliminates blocking on events.
My recommendation would be to move your while(..) loop into your main thread - you don't need the second one.
You could then have it update your global state,and do any event processing from the queue.In order to prevent the huge CPU usage,have the main thread sleep for a short interval every time.It could look like:
while(!exitCondition)
{
UpdateGlobalState();
ProcessEventQueue();
System.Threading.Thread.Sleep(10); // Sleep for a short period here,to avoid huge,unnecessary CPU usage
}
有相当多的话题.
1)你就可以离开这个在主线.除非主线会做一些工作自身,没有理由有中等线的循环.
二),因为你要更新一些全球国家“几乎没有”,你将需要处理,经常发生的.这就消除阻塞.
我建议你将移动时,(……)回路进入你的主线,你不需要另一个.
然后你就可以拥有它更新你的全球性的状态,并做任何事件处理从队列中.为了防止巨大的CPU时间,有主线睡一段间隔时间.它看起来就像.
虽然(!exitCondition).
{
UpdateGlobalState().
ProcessEventQueue().
System.Threading.Thread.Sleep(10);/ /睡在短时间内,以避免不必要的CPU巨大
}
1)你就可以离开这个在主线.除非主线会做一些工作自身,没有理由有中等线的循环.
二),因为你要更新一些全球国家“几乎没有”,你将需要处理,经常发生的.这就消除阻塞.
我建议你将移动时,(……)回路进入你的主线,你不需要另一个.
然后你就可以拥有它更新你的全球性的状态,并做任何事件处理从队列中.为了防止巨大的CPU时间,有主线睡一段间隔时间.它看起来就像.
虽然(!exitCondition).
{
UpdateGlobalState().
ProcessEventQueue().
System.Threading.Thread.Sleep(10);/ /睡在短时间内,以避免不必要的CPU巨大
}
英语翻译There are quite a few issues here:1) You can leave this
There is little water here; but there are quite a few empty
说明选的原因There are quite a few ____ along this strees.A flowers
There are quite a few words and ________(express) in this un
There are a few还是few apples here ,would you go to buy any还是s
单句改错.1.There is a few water here.You can drink it.2.There ar
There are a few( )in this office.
1.Here are a pen and two books for you. 2.There are no leave
英语翻译Leave you for a few months,I do not know what you are,No
There are few books that you can read in this book store中文意思
here are a few tips for you to go take acre of this right no
There are quite a few books on the shelf There are __ __ on