日期:2014-05-17 浏览次数:21032 次
private void button1_Click(object sender, EventArgs e)
{
Thread t = new Thread(new ThreadStart(Test));
t.Start();
this.button1.Enabled = false;
this.button2.Enabled = false;
}
private void t()
{
int i = 1;
……
}
list<Thread> ThreadList=new list<Thread>//创建线程池
for(int i=0;i<100;i++) //建立线程
{ Thread newt = new Thread(方法);
newt.name = "Thread" + i.Tostring();
ThreadList.add(newt.name);
newt.start();
}
foreach(Thread t in ThreadList)//将线程池里的线程逐一拉出来销毁
{
t.abort();
}