开发者

vb.net web application threading

开发者 https://www.devze.com 2023-04-01 08:43 出处:网络
I have some functions in a web application that do a lot of calculations and as a result have high CPU usage which affects the rest of the application when other users are accessing it.

I have some functions in a web application that do a lot of calculations and as a result have high CPU usage which affects the rest of the application when other users are accessing it.

I have tried backgroundworker to no avail , the only thing that seems to work in using another thr开发者_StackOverflow社区ead and setting the priority to low, can the UI be updated from a worker thread? specifically I am trying to bind a grid to a dataset processed in the worker thread


If you call Application.DoEvents() periodically to process the windows message queue, this will allow the UI to be updated and respond to user input.

You need to understand that many people consider DoEvents to be evil. As the UI will respond to events such as click, you should beware of any issues this can cause such as allowing many of your heavy CPU BackgroundWorker threads to be spawned. However, used correctly DoEvents provides a valid strategy for keeping your application responsive during processing.

0

精彩评论

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

关注公众号