gpt4 book ai didi

.net - .NET垃圾收集和 native 线程

转载 作者:行者123 更新时间:2023-12-03 11:56:53 24 4
gpt4 key购买 nike

相当有据可查的是,当.NET的自动垃圾收集器运行时,它将暂时暂停与应用程序域关联的所有正在运行的托管线程。我无法发现的是发生垃圾回收时(例如,使用_beginthreadex()而不是System.Threading.Thread())由应用程序创建的 native 线程发生了什么的详细信息。他们是同样地暂停还是左奔跑?

最佳答案

this有帮助吗?

"A GC won't stop threads that are not running managed code. Since those threads can't be touching the GC's heap anyways, there's no need for the GC to coordinate with them."

"If a thread was in managed code but called out to native code, it will continue to run. It will be stopped if it returns back to managed code."

关于.net - .NET垃圾收集和 native 线程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1870381/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com