다음을 통해 공유


Thread.Suspend, Garbage Collection, and Safe Points 

When you call Thread.Suspend on a thread, the system notes that a thread suspension has been requested and allows the thread to execute until it has reached a safe point before actually suspending the thread. A safe point for a thread is a point in its execution at which garbage collection can be performed.

Once a safe point is reached, the runtime guarantees that the suspended thread will not make any further progress in managed code. A thread executing outside managed code is always safe for garbage collection, and its execution continues until it attempts to resume execution of managed code.

NoteNote

In order to perform a garbage collection, the runtime must suspend all the threads except the thread performing the collection. Each thread must be brought to a safe point before it can be suspended.

See Also

Reference

Thread
GC

Concepts

Automatic Memory Management

Other Resources

Managed Threading