该线程也BackgroundWorker的完成事件处理程序上运行? [英] which thread does backgroundworker completed event handler run on?

查看:195
本文介绍了该线程也BackgroundWorker的完成事件处理程序上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要长时间运行计算的GUI应用程序(想一分钟以上)和方式,它涉及这是通过为计算后台工作。 (这部分是罚款)

I have a GUI application that needs to run long calculations (think a minute or more) and the way that it deals with this is by giving the calculation to a background worker. (this part is fine)

我的问题是,如果我这样做:
this.backgroundWorker.RunWorkerCompleted + =新System.ComponentModel.RunWorkerCompletedEventHandler( this.doSomethingElse);

The question I have is if I do something like: this.backgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.doSomethingElse);

是doSomethingElse将要在线程池中的后台工作运行在主UI线程或任何上运行?

is doSomethingElse going to be run on the main UI thread or whatever in the thread pool the background worker ran on?

感谢任何帮助,您可以提供。

thank for any help you can provide.

推荐答案

这是怎么回事在同一个线程BackgroundWorker的是,即最常用的UI线程中运行。

It's going to be run in the same thread that BackgroundWorker is in, ie most usually the UI thread.

这篇关于该线程也BackgroundWorker的完成事件处理程序上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆