Compartilhar via


JoinableTask Class

Tracks asynchronous operations and allows you to join asynchronous operations to avoid deadlocks while synchronously blocking the Main thread until the completion of the operation.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Threading.JoinableTask
    Microsoft.VisualStudio.Threading.JoinableTask<T>

Namespace:  Microsoft.VisualStudio.Threading
Assembly:  Microsoft.VisualStudio.Threading (in Microsoft.VisualStudio.Threading.dll)

Syntax

'Declaration
Public Class JoinableTask
public class JoinableTask
public ref class JoinableTask
type JoinableTask =  class end
public class JoinableTask

The JoinableTask type exposes the following members.

Properties

  Name Description
Public property IsCompleted Determines whether the asynchronous operation represented by this instance has completed.
Public property Task Gets the asynchronous task that completes when the asynchronous operation completes.

Top

Methods

  Name Description
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetAwaiter Gets an awaiter that is equivalent to calling JoinAsync.
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Join Synchronously blocks the calling thread until the operation has completed. If the calling thread is the Main thread, deadlocks are mitigated.
Public method JoinAsync Joins any main thread affinity of the caller with the asynchronous operation. This is to avoid deadlocks in case the main thread ultimately synchronously blocks while it is waiting for the operation to complete.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Threading Namespace