开发者

Is BackgroundWorker suitable for long-running operation?

开发者 https://www.devze.com 2022-12-22 07:36 出处:网络
any idea suggestion about BGW for long-runn开发者_C百科ing operation?Yes it is :). There is nothing inherently wrong in having long-running operations in a BackgroundWorker or a ThreadPool... if there

any idea suggestion about BGW for long-runn开发者_C百科ing operation?


Yes it is :). There is nothing inherently wrong in having long-running operations in a BackgroundWorker or a ThreadPool... if there are deadlocks in the code because of long-running operations, then there is something wrong with the code.


Suggestion: allow your operation to cancel. BGW allows for this by setting a bool property. You need to periodically check this property in your DoWork method.

0

精彩评论

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