Thread Pool and .IsBackground in .NET

前端 未结 3 2050
慢半拍i
慢半拍i 2021-01-18 03:27

MSDN, as well as many other sources, claim that worker threads in the thread pool are always background.

"Thread pool threads are background threads

3条回答
  •  忘掉有多难
    2021-01-18 04:22

    When does the thread finish? When your method ends? I highly doubt that's the case. The whole point of the thread pool is that once your thread is finished, it gets put back in the pool to be reused. Now you've let go of a thread, it's gone back into the thread pool and your application is still running because it's a foreground thread. There's no way to get that thread back out to kill it.

提交回复
热议问题