C#如何关闭一个线程
来源:百度知道 编辑:UC知道 时间:2024/05/14 09:10:07
当我开启一个线程后不知如何关闭,各位Csharper指导一下
System.Threading.Thread.CurrentThread返回的是当前线程的一个实例
关闭线程可以调用该线程实例的关闭方法Close()
如:
thread t=new thread();
t.close();
或
System.Threading.Thread.CurrentThread.Close();
thread t=new thread();
t。close();
thread.kill
myThread.Abort(); //终止线程