using System;
using System.Threading;

namespace MultiThreadDemo
{
    class Program
    {
        public static void threadfunc()
        {
            try
            {
                Console.WriteLine("Child thread starts");
                Thread.Sleep(1000);
            }
            catch (ThreadAbortException / *ex* /)
            {
                Console.WriteLine("Thread abort!");
            }
        }

        static void Main(string[] args)
        {
            ThreadStart func = new ThreadStart(threadfunc);
            Thread th = new Thread(func);

            th.Start();
            Thread.Sleep(500);

            th.Abort();

            Console.ReadLine();
        }
    }
}
ThreadStart 无需传参给线程函数时

相关文章: