BorCon 2003: Threading Session Follow Up

In my threading session at BorCon, a member of the audience asked how you could prevent the CLR from suspending threads durring garbage collection in .NET. Well, I finally had the time to do some research on this subject so here is the answer to this question.

The short answer is: you cannot prevent the CLR from suspending managed threads in .NET. However, if your managed thread is running in unmanaged mode, the CLR will allow the thread to continue, since any object references are pinned (locked down). When the thread returns to managed code, the CLR will suspend the thread. Detailed information on this algorithm is available from Jeffrey Richter’s Applied Microsoft .NET Framework Programming.

This entry was posted in .NET, Delphi. Bookmark the permalink.