开发者

.NET Garbage Collection and Native Threads

开发者 https://www.devze.com 2022-12-14 00:24 出处:网络
It’s fairly well documented that when .NET\'s automatic garbage collector runs, it will temporarily pause all running managed threads associated with the application domain. What I haven\'t been able

It’s fairly well documented that when .NET's automatic garbage collector runs, it will temporarily pause all running managed threads associated with the application domain. What I haven't been able to discover are d开发者_如何学Pythonetails on what happens to native threads created by the application when garbage collection occurs (ie. using _beginthreadex() instead of System.Threading.Thread()). Are they similarly paused or are the left running?


Does this help?

"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."

0

精彩评论

暂无评论...
验证码 换一张
取 消