Partilhar via


JoinableTask<T> Class

Definition

Tracks asynchronous operations and provides the ability to Join those operations to avoid deadlocks while synchronously blocking the Main thread for the operation's completion.

generic <typename T>
public ref class JoinableTask : Microsoft::VisualStudio::Threading::JoinableTask
template <typename T>
[Windows::Foundation::Metadata::WebHostHidden]
class JoinableTask : Microsoft::VisualStudio::Threading::JoinableTask
[System.Diagnostics.DebuggerDisplay("IsCompleted: {IsCompleted}, Method = {EntryMethodInfo != null ? EntryMethodInfo.Name : null}")]
public class JoinableTask<T> : Microsoft.VisualStudio.Threading.JoinableTask
[<System.Diagnostics.DebuggerDisplay("IsCompleted: {IsCompleted}, Method = {EntryMethodInfo != null ? EntryMethodInfo.Name : null}")>]
type JoinableTask<'T> = class
    inherit JoinableTask
Public Class JoinableTask(Of T)
Inherits JoinableTask

Type Parameters

T

The type of value returned by the asynchronous operation.

Inheritance
JoinableTask<T>
Attributes

Remarks

For more complete comments please see the JoinableTaskContext.

Properties

IsCompleted

Gets a value indicating whether the async operation represented by this instance has completed, as represented by its Task property's IsCompleted value.

(Inherited from JoinableTask)
Task

Gets the asynchronous task that completes when the async operation completes.

Methods

GetAwaiter()

Gets an awaiter that is equivalent to calling JoinAsync(CancellationToken).

Join(CancellationToken)

Synchronously blocks the calling thread until the operation has completed. If the calling thread is the Main thread, deadlocks are mitigated.

JoinAsync(CancellationToken)

Joins any main thread affinity of the caller with the asynchronous operation to avoid deadlocks in the event that the main thread ultimately synchronously blocks waiting for the operation to complete.

Extension Methods

AsVsTask<T>(JoinableTask<T>)

Wraps a JoinableTask<T> instance in an IVsTask that can be returned to COM clients.

FileAndForget(JoinableTask, String, String, Func<Exception,Boolean>)

Records error information when the given JoinableTask faults.

Applies to

Thread Safety

This type is thread-safe for all members.