JoinableTaskFactory Class
A factory for starting asynchronous tasks that can mitigate deadlocks when the tasks require the Main thread of an application and the Main thread may itself be blocking on the completion of a task.
Assembly: Microsoft.VisualStudio.Threading (in Microsoft.VisualStudio.Threading.dll)
Microsoft.VisualStudio.Threading::JoinableTaskFactory
Microsoft.VisualStudio.Threading::DelegatingJoinableTaskFactory
| Name | Description | |
|---|---|---|
![]() | JoinableTaskFactory(JoinableTaskCollection^) | Initializes a new instance of JoinableTaskFactory that adds all generated jobs to the specified collection. |
![]() | JoinableTaskFactory(JoinableTaskContext^) | Initializes a new instance of JoinableTaskFactory with the specified owning context. |
| Name | Description | |
|---|---|---|
![]() | Context | Gets the joinable task context to which this factory belongs. |
![]() | HangDetectionTimeout | Gets or sets the time between the last activity on a synchronously-blocking thread and the beginning of data collection about a possible hang. |
![]() | UnderlyingSynchronizationContext | Gets the underlying SynchronizationContext that controls the main thread in the host. |
| Name | Description | |
|---|---|---|
![]() | Add(JoinableTask^) | Adds the specified joinable task to the applicable collection. |
![]() | Equals(Object^) | (Inherited from Object.) |
![]() | Finalize() | (Inherited from Object.) |
![]() | GetHashCode() | (Inherited from Object.) |
![]() | GetType() | (Inherited from Object.) |
![]() | MemberwiseClone() | (Inherited from Object.) |
![]() | OnTransitionedToMainThread(JoinableTask^, Boolean) | Occurs whenever a joinable task has completed a transition to the main thread. |
![]() | OnTransitioningToMainThread(JoinableTask^) | Occurs when a joinable task has requested a transition to the main thread. |
![]() | PostToUnderlyingSynchronizationContext(SendOrPostCallback^, Object^) | Posts a callback to the main thread via the underlying dispatcher, or to the threadpool when no dispatcher exists on the main thread. |
![]() | Run(Func<Task^>^) | Runs the specified asynchronous method. |
![]() | Run<T>(Func<Task<T>^>^) | Runs the specified asynchronous method. |
![]() | RunAsync(Func<Task^>^) | Wraps the invocation of an asynchronous method so that it may execute asynchronously, but may potentially be synchronously completed (waited on) in the future. |
![]() | RunAsync<T>(Func<Task<T>^>^) | Wraps the invocation of an asynchronous method so that it may execute asynchronously, but may potentially be synchronously completed (waited on) in the future. |
![]() | SwitchToMainThreadAsync(CancellationToken) | Gets an awaitable whose continuations execute on the synchronization context with which this instance was initialized, so that both deadlocks and reentrancy are mitigated. |
![]() | ToString() | (Inherited from Object.) |
![]() | WaitSynchronously(Task^) | Synchronously blocks the calling thread for the completion of the specified task. If running on the main thread, any applicable message pump is suppressed while the thread sleeps. |
![]() | WaitSynchronouslyCore(Task^) | Synchronously blocks the calling thread for the completion of the specified task. |
For more complete comments please see JoinableTaskContext.
This type is thread-safe for all members.



