Delen via


JoinableTask<T> Class

Tracks asynchronous operations and allows you to Join asynchronous operations. This is 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(Of T) _
    Inherits JoinableTask
public class JoinableTask<T> : JoinableTask
generic<typename T>
public ref class JoinableTask : public JoinableTask
type JoinableTask<'T> =  
    class 
        inherit JoinableTask 
    end
JScript does not support generic types or methods.

Type Parameters

  • T
    The type of the value returned by the asynchronous operation.

The JoinableTask<T> type exposes the following members.

Properties

  Name Description
Public property IsCompleted Determines whether the asynchronous operation represented by this instance has completed. (Inherited from JoinableTask.)
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 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