using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ThreadStart thr_start_func = new ThreadStart(First_Thread);
Console.WriteLine("Creating the first thread ");
Thread fThread = new Thread(thr_start_func);
fThread.Name = "first_thread";
fThread.Start(); //starting the thread
Thread sThread = new Thread(new ThreadStart(Second_Thread));
sThread.Name = "second_thread";
sThread.Start();
} public static void First_Thread()
{
Console.WriteLine("First thread created");
Thread current_thread = Thread.CurrentThread;
string thread_details = "Thread Name: " + current_thread.Name + "\r\nThread State: " + current_thread.ThreadState.ToString() + "\r\n Thread Priority level:" + current_thread.Priority.ToString();
Console.WriteLine("The details of the thread are :" + thread_details);
Console.WriteLine("first thread terminated");
} public static void Second_Thread()
{
Console.WriteLine("Second thread created");
Thread current_thread = Thread.CurrentThread;
string thread_details = "Thread Name: " + current_thread.Name + "\r\nThread State: " + current_thread.ThreadState.ToString() + "\r\n Thread Priority level:" + current_thread.Priority.ToString();
Console.WriteLine("The details of the thread are :" + thread_details);
Console.WriteLine("second thread terminated");
}
}
}
//如果不是,谁能提供一个简单的、多线明确的源代码示例?
using System.Collections.Generic;
using System.Text;
using System.Threading;namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ThreadStart thr_start_func = new ThreadStart(First_Thread);
Console.WriteLine("Creating the first thread ");
Thread fThread = new Thread(thr_start_func);
fThread.Name = "first_thread";
fThread.Start(); //starting the thread
Thread sThread = new Thread(new ThreadStart(Second_Thread));
sThread.Name = "second_thread";
sThread.Start();
} public static void First_Thread()
{
Console.WriteLine("First thread created");
Thread current_thread = Thread.CurrentThread;
string thread_details = "Thread Name: " + current_thread.Name + "\r\nThread State: " + current_thread.ThreadState.ToString() + "\r\n Thread Priority level:" + current_thread.Priority.ToString();
Console.WriteLine("The details of the thread are :" + thread_details);
Console.WriteLine("first thread terminated");
} public static void Second_Thread()
{
Console.WriteLine("Second thread created");
Thread current_thread = Thread.CurrentThread;
string thread_details = "Thread Name: " + current_thread.Name + "\r\nThread State: " + current_thread.ThreadState.ToString() + "\r\n Thread Priority level:" + current_thread.Priority.ToString();
Console.WriteLine("The details of the thread are :" + thread_details);
Console.WriteLine("second thread terminated");
}
}
}
//如果不是,谁能提供一个简单的、多线明确的源代码示例?
http://www.cnblogs.com/greatandforever/archive/2008/07/08/1238300.html