Thread.Sleep(10);
trd.Suspend();
//trd.Abort();
//trd.Join();
Console.WriteLine("/n ======== A.Run has finished ==========");
try
{
Console.WriteLine("Try to restart the A.Run...");
trd.Start();
}
catch (ThreadStateException e)
{
Console.WriteLine(e.ToString());
}
catch (System.Exception e)
{
Console.WriteLine(e.ToString());
}
Console.WriteLine("============ end of operator thread ==================");
}
}
class A
{
private string m_strVal;
public A(string str)
{
m_strVal = str;
}
public void Run()
{
Thread.CurrentThread.Name = "The A Thread";//当前线程的名称
while (true)
{
CRunThread.PrintThreadInfo();
Console.WriteLine("strValue:" + m_strVal);
Console.WriteLine("A.Run is runing in its own thread...");
}
}
}