Exemplo n.º 1
0
        internal static Action CaptureExecutionContext(this Action action)
        {
            var context = ExecutionContextEx.Capture();

            if (context == null)
            {
                return(action);
            }

            return(() => ExecutionContextEx.Run(context, state => ((Action)state).Invoke(), action));
        }
Exemplo n.º 2
0
 public void Invoke()
 {
     if (Scheduler == null)
     {
         if (_executionContext == null)
         {
             _action(_state);
         }
         else
         {
             ExecutionContextEx.Run(_executionContext, s_executionContextCallback, this);
         }
     }
     else
     {
         Scheduler.UnsafeSchedule(s_schedulerCallback, this);
     }
 }
Exemplo n.º 3
0
 public void AddContinuation(Action <object> continuation, object state, FutureScheduler scheduler = null)
 {
     AddContinuation(new PromiseContinuation(continuation, state, scheduler, ExecutionContextEx.Capture()));
 }