Thread.Suspend 메서드

정의

주의

Thread.Suspend has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202

주의

Thread.Suspend has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. https://go.microsoft.com/fwlink/?linkid=14202

스레드를 일시 중단하거나 스레드가 이미 일시 중단된 경우에는 아무런 효과가 없습니다.

public:
 void Suspend();
public void Suspend();
[System.Obsolete("Thread.Suspend has been deprecated.  Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources.  http://go.microsoft.com/fwlink/?linkid=14202", false)]
public void Suspend();
[System.Obsolete("Thread.Suspend has been deprecated.  Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources.  https://go.microsoft.com/fwlink/?linkid=14202", false)]
public void Suspend();
member this.Suspend : unit -> unit
[<System.Obsolete("Thread.Suspend has been deprecated.  Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources.  http://go.microsoft.com/fwlink/?linkid=14202", false)>]
member this.Suspend : unit -> unit
[<System.Obsolete("Thread.Suspend has been deprecated.  Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources.  https://go.microsoft.com/fwlink/?linkid=14202", false)>]
member this.Suspend : unit -> unit
Public Sub Suspend ()
특성

예외

.NET Core 및 .NET 5+만: 모든 경우에.

스레드가 시작되지 않았거나 중지되었습니다.

호출자에게 적절한 SecurityPermission기능이 없습니다.

설명

스레드가 이미 일시 중단된 경우 이 메서드는 영향을 주지 않습니다.

Caution

스레드의 Suspend 활동을 동기화하기 위해 메서드와 Resume 메서드를 사용하지 마세요. 스레드를 일시 중단할 때 실행 중인 코드를 알 수 있는 방법은 없습니다. 보안 권한 평가 중에 잠금을 보유하는 동안 스레드를 일시 중단하면 스레드의 다른 스레드가 AppDomain 차단될 수 있습니다. 클래스 생성자를 실행하는 동안 스레드를 일시 중단하면 해당 클래스를 AppDomain 사용하려는 다른 스레드가 차단됩니다. 교착 상태는 매우 쉽게 발생할 수 있습니다.

스레드에서 메서드를 Suspend 호출할 때 시스템은 스레드 일시 중단이 요청되었음을 확인하고 스레드가 실제로 스레드를 일시 중단하기 전에 안전한 지점에 도달할 때까지 스레드를 실행할 수 있도록 허용합니다. 스레드에 대한 안전 지점은 가비지 수집을 수행할 수 있는 실행 지점입니다. 안전 지점에 도달하면 런타임은 일시 중단된 스레드가 관리 코드에서 더 이상 진행되지 않도록 보장합니다. 관리 코드 외부에서 실행되는 스레드는 가비지 수집에 항상 안전하며 관리 코드 실행을 다시 시작할 때까지 실행이 계속됩니다.

적용 대상

추가 정보