Difference Between Delegate .BeginInvoke and Thread.Start

Existing related questions here speak of the differences between:

  • Delegate .BeginInvoke and Control.BeginInvoke
  • Control.BeginInvoke and Thread.Start

But what are the differences between Delegate.BeginInvoke and Thread.Start?

+6
multithreading
source share
2 answers

Thread.Start launches a new OS thread to execute the delegate. When the delegate returns, the stream is destroyed. This is a rather difficult operation (starting and destroying a thread), so you usually only do this if the method is lengthy.

Delegate.BeginInvoke will call a delegate in the thread pool thread. As soon as the method returns, the thread returns to the pool for reuse by another task. The advantage of this is that the sequence procedure in the thread pool is relatively easy because you do not need to deploy a new thread each time.

Control.BeginInvoke calls the method in the stream for the control. The user interface components are essentially single-threaded, and each interaction with the user interface control must be performed in the thread that created it. Control.BeginInvoke is a convenient way to do this.

+17
source share

See this question: differences in different ways of creating parallel programs for more information on the differences between different ways of running parallel code in .net.

+2
source share

All Articles