Asp.NET开启一个线程,不停的执行

时间:2023-03-09 07:15:33
Asp.NET开启一个线程,不停的执行

using System;
using System.Threading;
using System.Threading.Tasks;

class StartNewDemo
{
    static void Main()
    {
        while (true)
        {
            System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(Run));
            thread.Start();
            Thread.Sleep(10000);
        }
    }

private static void Run()
    {
        Console.WriteLine("aaaa");
        Console.WriteLine();
    }

}

相关文章