[英]Can Thread survive App termination?
If a .NET program creates and starts a System.Threading.ThreadPool
thread, and then the program ends (either naturally or by crashing): 如果.NET程序创建并启动System.Threading.ThreadPool
线程,然后程序结束(自然地或通过崩溃):
Thread
to survive and carry on processing on its own? Thread
可以存活并自行进行处理吗? 根据定义,如果进程的其中一个线程仍在工作,那么它实际上并没有结束 。
一个线程不能独立于一个进程生存,所以没有。
No. And from the horse's mouth (MSDN) 不,从马的嘴里(MSDN)
The threads in the managed thread pool are background threads. 托管线程池中的线程是后台线程。 That is, their
IsBackground
properties are true. 也就是说,它们的IsBackground
属性是真的。 This means that aThreadPool
thread will not keep an application running after all foreground threads have exited. 这意味着在所有前台线程退出后,ThreadPool
线程不会保持应用程序运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.