线程被终止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()
{
。。。
}
线程正在运行或被终止;它无法重新启动。,布布扣,bubuko.com
原文:http://www.cnblogs.com/3Sblogs/p/3913093.html