Aracılığıyla paylaş


Thread.Suspend Yöntem

Tanım

Dikkat

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

Dikkat

Thread.Suspend has been deprecated. Use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources.

Dikkat

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

İş parçacığını askıya alır veya iş parçacığı zaten askıya alınmışsa herhangi bir etkisi yoktur.

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 ();
[System.Obsolete("Thread.Suspend has been deprecated. Use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources.")]
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)>]
member this.Suspend : unit -> unit
[<System.Obsolete("Thread.Suspend has been deprecated. Use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources.")>]
member this.Suspend : unit -> unit
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
Public Sub Suspend ()
Öznitelikler

Özel durumlar

Yalnızca .NET Core ve .NET 5+ : Her durumda.

İş parçacığı başlamadı veya artık yok.

Çağıranın uygun SecurityPermission yok.

Açıklamalar

İş parçacığı zaten askıya alınmışsa, bu yöntemin hiçbir etkisi yoktur.

Dikkat

İş parçacıklarının Suspend Resume etkinliklerini eşitlemek için ve yöntemlerini kullanma. Bir iş parçacığını askıya alırken hangi kodun yürütül yaptığını öğrenmenin hiçbir yolu yoktur. Bir iş parçacığını bir güvenlik izni değerlendirmesi sırasında kilitler tutarken askıya alırsanız, içinde diğer AppDomain iş parçacıkları engellenmiş olabilir. Bir iş parçacığını bir sınıf oluşturucusu yürütürken askıya alırsanız, o sınıfı kullanmaya çalışan diğer AppDomain iş parçacıkları engellenir. Kilitlenmeler çok kolay oluşabilir.

Bir iş parçacığında yöntemini çağırarak, sistem bir iş parçacığının askıya alınmasının talep edildiğini not alır ve iş parçacığını gerçekten askıya almadan önce güvenli bir noktaya ulaşana kadar iş parçacığının yürütmeye izin Suspend verir. Bir iş parçacığı için güvenli bir nokta, yürütme sırasında çöp toplamanın gerçekleştirill olduğu bir noktadır. Güvenli bir noktaya ulaşıldıktan sonra çalışma zamanı, askıya alınan iş parçacığının yönetilen kodda daha fazla ilerleme kaydedilmayacağı garantisini sağlar. Yönetilen kodun dışında yürütülen bir iş parçacığı, çöp toplama için her zaman güvenlidir ve yönetilen kodun yürütülmesini sürdürmeye çalışana kadar yürütmesi devam eder.

Şunlara uygulanır

Ayrıca bkz.