码迷,mamicode.com
首页 > 其他好文 > 详细

Thread.Start和Delegate.BeginInvoke 以及Control.BeginInvoke

时间:2014-11-13 20:33:57      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:des   io   ar   os   sp   for   on   art   cti   

Thread.Start starts a new OS thread to execute the delegate. When the delegate returns, the thread is destroyed. This is quite a heavy-weight operation (starting and destroying a thread) so you typically only do it if the method is going to be long-running.

Delegate.BeginInvoke will call the delegate on a thread pool thread. Once the method returns, the thread is returned to the pool to be reused by another task. The advantage of this is that queueing a method to the thread pool is relatively light-weight because you don‘t have to spin up a whole new thread every time.

Control.BeginInvoke invokes the method on the thread for the control. UI components are inherently single-threaded and every interaction with a UI control must be done on the thread that created it. Control.BeginInvoke is a handy way to do that.

Thread.Start和Delegate.BeginInvoke 以及Control.BeginInvoke

标签:des   io   ar   os   sp   for   on   art   cti   

原文地址:http://www.cnblogs.com/chucklu/p/4095715.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!