2个回答
2013-02-01
展开全部
List<Thread> ThreadList = new List<Thread>();
每当有个新的线程出现
Thread a =new Thread(aa);
a.start();
ThreadList .add(a);//保存起来
判断线程是否结束
List<Thread> List2Remove = new List<Thread>();
while(ThreadList.count>0){
foreach(Thread a in ThreadList){
if(a.IsAlive==false) List2Remove.add(a);
}
foreach(Thread a in List2Remove){
if(a.IsAlive==false) ThreadList.Remove(a);
}
}
//所有线程都结束的话,list长度是0,跳出
每当有个新的线程出现
Thread a =new Thread(aa);
a.start();
ThreadList .add(a);//保存起来
判断线程是否结束
List<Thread> List2Remove = new List<Thread>();
while(ThreadList.count>0){
foreach(Thread a in ThreadList){
if(a.IsAlive==false) List2Remove.add(a);
}
foreach(Thread a in List2Remove){
if(a.IsAlive==false) ThreadList.Remove(a);
}
}
//所有线程都结束的话,list长度是0,跳出
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询