线程Thread

//启动线程
thread = new Thread(new ThreadStart(HelloWorld));
thread.Start();

protected void HelloWorld()
{
string str ;
Console.write("helloworld");
}
}

//杀死线程
if ( thread.IsAlive )
{
thread.Abort();
}

//暂停线程
thread.Sleep();

//设定线程优先级
//包括Normal, AboveNormal, BelowNormal, Highest, and Lowest几种
thread.Priority = ThreadPriority.Highest;

//挂起线程
if (thread.ThreadState = ThreadState.Running )
{
thread.Suspend();
}

//唤起线程
if (thread.ThreadState = ThreadState.Suspended )
{
thread.Resume();
}

 

posted on 2007-09-12 11:22  恋地高飞  阅读(391)  评论(0编辑  收藏  举报

导航