11 [StructLayout(
LayoutKind.Sequential, Size = 1)]
12 [__DynamicallyInvokable]
16 [StructLayout(
LayoutKind.Sequential, Size = 1)]
17 [__DynamicallyInvokable]
21 private static readonly
WaitCallback s_waitCallbackRunAction = RunAction;
27 [__DynamicallyInvokable]
30 [__DynamicallyInvokable]
41 [SecuritySafeCritical]
42 [__DynamicallyInvokable]
45 QueueContinuation(continuation, flowContext:
true);
52 [__DynamicallyInvokable]
55 QueueContinuation(continuation, flowContext:
false);
59 private static void QueueContinuation(
Action continuation,
bool flowContext)
61 if (continuation ==
null)
65 if (TplEtwProvider.Log.IsEnabled())
67 continuation = OutputCorrelationEtwEvent(continuation);
72 currentNoFlow.
Post(s_sendOrPostCallbackRunAction, continuation);
93 private static Action OutputCorrelationEtwEvent(
Action continuation)
95 int continuationId =
Task.NewId();
96 Task internalCurrent =
Task.InternalCurrent;
97 TplEtwProvider.Log.AwaitTaskContinuationScheduled(
TaskScheduler.
Current.
Id, internalCurrent?.Id ?? 0, continuationId);
98 return AsyncMethodBuilderCore.CreateContinuationWrapper(continuation, delegate
100 TplEtwProvider log = TplEtwProvider.Log;
101 log.TaskWaitContinuationStarted(continuationId);
102 Guid oldActivityThatWillContinue =
default(Guid);
103 if (log.TasksSetActivityIds)
108 if (log.TasksSetActivityIds)
112 log.TaskWaitContinuationComplete(continuationId);
116 private static void RunAction(
object state)
122 [__DynamicallyInvokable]
130 [__DynamicallyInvokable]
static new TaskFactory< TResult > Factory
Provides access to factory methods for creating and configuring T:System.Threading....
virtual void Post(SendOrPostCallback d, object state)
When overridden in a derived class, dispatches an asynchronous message to a synchronization context.
YieldAwaiter GetAwaiter()
Retrieves a T:System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter object for this instance of...
static TaskScheduler?? Current
Gets the T:System.Threading.Tasks.TaskScheduler associated with the currently executing task.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Represents an operation that schedules continuations when it completes.
Propagates notification that operations should be canceled.
delegate void SendOrPostCallback(object state)
Represents a method to be called when a message is to be dispatched to a synchronization context.
static bool QueueUserWorkItem(WaitCallback callBack, object state)
Queues a method for execution, and specifies an object containing data to be used by the method....
LayoutKind
Controls the layout of an object when exported to unmanaged code.
Represents an object that handles the low-level work of queuing tasks onto threads.
static bool UnsafeQueueUserWorkItem(WaitCallback callBack, object state)
Queues the specified delegate to the thread pool, but does not propagate the calling stack to the wor...
delegate void Action()
Encapsulates a method that has no parameters and does not return a value.
TaskCreationOptions
Specifies flags that control optional behavior for the creation and execution of tasks.
void UnsafeOnCompleted(Action continuation)
Posts the continuation back to the current context.
Provides the context for waiting when asynchronously switching into a target environment.
static TaskScheduler Default
Gets the default T:System.Threading.Tasks.TaskScheduler instance that is provided by the ....
SecurityAction
Specifies the security actions that can be performed using declarative security.
int Id
Gets the unique ID for this T:System.Threading.Tasks.TaskScheduler.
bool IsCompleted
Gets a value that indicates whether a yield is not required.
static void SetCurrentThreadActivityId(Guid activityId)
[Supported in the .NET Framework 4.5.1 and later versions] Sets the activity ID on the current thread...
Provides the ability to create events for event tracing for Windows (ETW).
Provides the basic functionality for propagating a synchronization context in various synchronization...
void GetResult()
Ends the await operation.
void OnCompleted(Action continuation)
Sets the continuation to invoke.
Creates or manipulates threads other than its own, which might be harmful to the host.
delegate void WaitCallback(object state)
Represents a callback method to be executed by a thread pool thread.
Represents an awaiter that schedules continuations when an await operation completes.
Provides a pool of threads that can be used to execute tasks, post work items, process asynchronous I...
Represents an asynchronous operation that can return a value.
Provides an awaiter for switching into a target environment.