Solved

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

Posted on 2004-08-28
4
892 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
4 Comments
 
LVL 2

Accepted Solution

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

Assisted Solution

by:gregoryyoung
gregoryyoung earned 250 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now