Table of Contents

Class DelegatingJoinableTaskFactory

Namespace
Microsoft.VisualStudio.Threading
Assembly
Microsoft.VisualStudio.Threading.dll

A JoinableTaskFactory base class for derived types that delegate some of their work to an existing instance.

public class DelegatingJoinableTaskFactory : JoinableTaskFactory
Inheritance
DelegatingJoinableTaskFactory
Inherited Members

Remarks

All virtual methods default to calling into the inner JoinableTaskFactory for its behavior, rather than the default behavior of the base class. This is useful because a derived-type cannot call protected methods on another instance of that type.

Constructors

DelegatingJoinableTaskFactory(JoinableTaskFactory)

Initializes a new instance of the DelegatingJoinableTaskFactory class.

protected DelegatingJoinableTaskFactory(JoinableTaskFactory innerFactory)

Parameters

innerFactory JoinableTaskFactory

The inner factory that will create the tasks.

Methods

OnTransitionedToMainThread(JoinableTask, bool)

Raised whenever a joinable task has completed a transition to the main thread.

protected override void OnTransitionedToMainThread(JoinableTask joinableTask, bool canceled)

Parameters

joinableTask JoinableTask

The task whose request to transition to the main thread has completed.

canceled bool

A value indicating whether the transition was cancelled before it was fulfilled.

Remarks

This event is usually raised on the main thread, but can be on another thread when canceled is true.

OnTransitioningToMainThread(JoinableTask)

Raised when a joinable task has requested a transition to the main thread.

protected override void OnTransitioningToMainThread(JoinableTask joinableTask)

Parameters

joinableTask JoinableTask

The task requesting the transition to the main thread.

Remarks

This event may be raised on any thread, including the main thread.

PostToUnderlyingSynchronizationContext(SendOrPostCallback, object)

Posts a message to the specified underlying SynchronizationContext for processing when the main thread is freely available.

protected override void PostToUnderlyingSynchronizationContext(SendOrPostCallback callback, object state)

Parameters

callback SendOrPostCallback

The callback to invoke.

state object

State to pass to the callback.

WaitSynchronously(Task)

Synchronously blocks the calling thread for the completion of the specified task.

protected override void WaitSynchronously(Task task)

Parameters

task Task

The task whose completion is being waited on.