Skip to content
欢迎扫码关注公众号

线程的 IsBackground

下面的代码需要工作结束后,敲一下回车,程序才会结束。

如果将 IsBackground 改为 true,效果会怎样?

cs
using System;
using System.Threading;

namespace LookOutForIsBackground
{
    class Program
    {
        static void Main(string[] args)
        {
            Thread t = new Thread(() =>
            {
                Console.WriteLine("线程开始工作。。。");
                // 省略工作代码
                Console.ReadKey();
                Console.WriteLine("线程结束");
            });
            // 注意,默认就是 false
            t.IsBackground = false;
            t.Start();
            Console.WriteLine("主线程结束");
        }
    }
}

Page Layout Max Width

Adjust the exact value of the page width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the page layout
A ranged slider for user to choose and customize their desired width of the maximum width of the page layout can go.

Content Layout Max Width

Adjust the exact value of the document content width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the content layout
A ranged slider for user to choose and customize their desired width of the maximum width of the content layout can go.