Background Threads in C#

后端 未结 3 808
清歌不尽
清歌不尽 2021-01-05 17:52

I am new to C#.I learnt that normally all threads are foreground until unless you explicitly specify it as \"background\" thread using IsBackGround= true .

3条回答
  •  忘掉有多难
    2021-01-05 18:32

    All it means is whether this thread will keep the process alive. If all the threads in your process are marked background then .Net will shut down your process and force it to exit.

    In answer to your question, yes you have to join as the thread which is in the background will not keep it alive, thus when the startup thread leaves Main() then it will allow the application to exit.

提交回复
热议问题