?
Solved

DEFINITION: Different between Delegate.BeginInvoke and Thread.Start()

Posted on 2004-08-28
4
Medium Priority
?
905 Views
Last Modified: 2008-03-03
If I have a method of type

public void myMethod()
{

}

And I create a delegate void NewDelegate(void)

What is the actual difference between the following calls and how they are handled by .NET and the OS

NewDelegate del = NewDelegate(myMethod);
del.BeginInvoke(null, null);

and

Thread t = new Thread(new ThreadStart(myMethod));
t.Start();

I know the delegate will use a thread from the thread pool, but will the thread t as well?  What is the actual effect of one versus the other.
0
Comment
Question by:jjacksn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Accepted Solution

by:
shaival_trivedi earned 1000 total points
ID: 11919788
0
 
LVL 37

Assisted Solution

by:gregoryyoung
gregoryyoung earned 1000 total points
ID: 11921282
it will create a new thread delegate.begininvoke will not it will be queued into the thread pool.

however there are some caveats within the CLR that make the thread not necesarily exclusively owned.

If you look at the thread class you will read "Note   An operating-system ThreadId has no fixed relationship to a managed thread, because an unmanaged host can control the relationship between managed and unmanaged threads. Specifically, a sophisticated host can use the CLR Hosting API to schedule many managed threads against the same operating system thread, or to move a managed thread between different operating system threads." this pretty much says it all.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month11 days, 1 hour left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question