Partager via


JoinableTask 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.

public ref class JoinableTask
[Windows::Foundation::Metadata::WebHostHidden]
public ref class JoinableTask
[Windows::Foundation::Metadata::WebHostHidden]
class JoinableTask
[System.Diagnostics.DebuggerDisplay("IsCompleted: {IsCompleted}, Method = {EntryMethodInfo != null ? EntryMethodInfo.Name : null}")]
public class JoinableTask
[<System.Diagnostics.DebuggerDisplay("IsCompleted: {IsCompleted}, Method = {EntryMethodInfo != null ? EntryMethodInfo.Name : null}")>]
type JoinableTask = class
Public Class JoinableTask
Inheritance
JoinableTask
Derived
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.

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 caller is on the Main thread (or is executing within a JoinableTask that has access to the main thread) the caller's access to the Main thread propagates to this JoinableTask so that it may also access the main thread.

JoinAsync(CancellationToken)

Shares any access to the main thread the caller may have 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

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.