using System.Threading; namespace VirtualConveyor.Utils { public class ThreadHelper { /// /// 开启线程 /// public static void StartThread(Thread thread) { if (thread != null) { thread.IsBackground = true; thread.Start(); } } /// /// 开启带参数的线程 /// public static void StartThread(Thread thread, object obj) { if (thread != null) { thread.IsBackground = true; thread.Start(obj); } } /// /// 关闭线程 /// /// 需要关闭的线程 public static void CloseThread(Thread thread) { if (thread != null) { thread.Abort(); } } } }