ke_junjie
2025-06-04 84620534eb627e95811b971a4b552b6a177829bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System.Threading;
 
namespace iWareCommon.Utils
{
    public class ThreadHelper
    {
        /// <summary>
        /// 开启线程
        /// </summary>  
        public static void StartThread(Thread thread)
        {
            if (thread != null)
            {
                thread.IsBackground = true;
                thread.Start();
            }
        }
 
        /// <summary>
        /// 开启带参数的线程
        /// </summary>
        public static void StartThread(Thread thread, object obj)
        {
            if (thread != null)
            {
                thread.IsBackground = true;
                thread.Start(obj);
            }
        }
 
 
        /// <summary>
        /// 关闭线程
        /// </summary>
        /// <param name="thread">需要关闭的线程</param>
        public static void CloseThread(Thread thread)
        {
            if (thread != null)
            {
                thread.Abort();
            }
        }
 
    }
}