线程被终止abort了无法再次启动,可以先挂起suspend,再resume()
bool bl = false;
Thread thrd;
public Form1()
{
InitializeComponent();
thrd = new Thread(tAR);
}
private void btn_Click(object sender, EventArgs e)
{
if (bl == false)
{
if (thrd.ThreadState == ThreadState.Suspended)
{
thrd.Resume();
}
else
{
thrd.Start();
}
bl = true;
}
else
{
if (thrd.IsAlive == true)
{
this.thrd.Suspend();
}
bl = false;
}
}
private void tAR()
{
。。。
}