Thread.Resume 方法

定义

警告

此 API 现已过时。

继续已挂起的线程。Resumes a thread that has been suspended.

public:
 void Resume();
[System.Obsolete("Thread.Resume 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)]
[System.Obsolete("Thread.Resume 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)]
[System.Obsolete("Thread.Resume 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 Resume ();
member this.Resume : unit -> unit
Public Sub Resume ()
属性

异常

仅限 .NET Core:不支持此成员。.NET Core only: This member is not supported.

该线程尚未启动、 已死或未处于挂起状态。The thread has not been started, is dead, or is not in the suspended state.

调用方没有适当的 SecurityPermissionThe caller does not have the appropriate SecurityPermission.

注解

注意

不要使用 SuspendResume 方法来同步线程的活动。Do not use the Suspend and Resume methods to synchronize the activities of threads. 您无法知道线程在挂起时正在执行的代码。You have no way of knowing what code a thread is executing when you suspend it. 如果在安全权限评估过程中挂起一个处于锁定状态的线程,则 AppDomain 中的其他线程可能会被阻止。If you suspend a thread while it holds locks during a security permission evaluation, other threads in the AppDomain might be blocked. 如果在线程执行类构造函数时挂起线程,则会阻止 AppDomain 中尝试使用该类的其他线程。If you suspend a thread while it is executing a class constructor, other threads in the AppDomain that attempt to use that class are blocked. 死锁可能会非常简单。Deadlocks can occur very easily.

安全性

SecurityPermission
用于线程的高级操作。for advanced operations on threads. 关联的枚举: ControlThreadAssociated enumeration: ControlThread

适用于

另请参阅