.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Home >> Code Snippets >> Threading >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets


Posted By:nishithraj       Posted Date: November 27, 2009    Points: 10    Category: Threading    URL: http://www.dotnetspark.com  

A thread is a unit of execution to which the OS allocates CPU time. Dotnet supports multi threading feature which was not available with their earlier products(like VB, ASP etc).
ThreadStart is a delegate used to create a thread object.

Here is a code sample for Threading in Csharp

public static void Main()
// create a object for ThreadStart delegate
ThreadStart worker = new ThreadStart(Callme);
Thread t = new Thread(worker);
t.Name="My Thread";
Console.WriteLine(t.Name +" State: "+t.ThreadState);
//starting the thread
//Thread state provides the current state of the particular thread
Console.WriteLine(t.Name +" State: "+t.ThreadState);
Console.WriteLine("X= " + x +" Good Bye");


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend