作者reptile0426 ( )
看板C_Sharp
标题[问题] delegate.BeginInvoke跟control.invoke不同
时间Wed Nov 21 16:40:19 2007
我上网看了一下
发现他们不同的地方"好像是" 唤起的thread不同
下面是我找到的文章
When you call Control.BeginInvoke,
the call to Control.Invoke is made on a threadpool thread and the call to
BeginInvoke returns immediately. So, in effect, you have a worker thread
calling BeginInvoke. The threadpool thread then takes over and calls
Control.Invoke, waiting on the return value. The delegate passed to Invoke
is then invoked on the UI thread.
If you call Delegate.BeginInvoke, then you go from your worker thread to
the threadpool thread, where the method pointed to by the delegate gets
executed. If you are accessing UI elements on this thread, you are going to
get unpredictable results.
但是我又对worker thread这个东西有点疑问
它不是UI thread,那他是什麽东西
一个windows form程式除了本身的main thread之外,背後还有一个worker thread
然後又冒出一个threadpool,这更让我想了解c#观念 越来越模糊
想请问一下各位前辈,可以指导小弟观念上的问题
谢谢各位
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 163.25.101.28
※ 编辑: reptile0426 来自: 163.25.101.28 (11/21 16:40)