开发者

How to 'avoid' application not responding when big elaboration are made?

When i lunch a function on my .net application, the app seems to be "blocked". So i a开发者_JS百科sk you: how can limit cpu workload for a particular method ? The only way is the Application.DoEvents ? And: what if i use an third party dll that for the same reason (big elaboration) seems to block (not responding) my app ?

EDIT: maybe threading is the answer, but, now, i've another question: is it possible to 'limit' cpu usage to a thread ?


How to 'avoid' application not responding when big elaboration are made?

Run whatever is causing the blocking on a different thread than the main thread.

how can limit cpu workload for a particular method ?

You can't limit it for a particular method. Only for a particular thread. And this will not solve the blocking issue.

maybe threading is the answer

No, not maybe. It is the answer.

but, now, i've another question: is it possible to 'limit' cpu usage to a thread ?

Well, you could try setting Thread.Priority. Note that the OS does not have to honor the priority that you set (thus, try). Additionally, this just changes the priority for scheduling the thread to execute. If there are no other threads that need CPU time, then of course your thread will still get scheduled on the CPU.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜