Exemple #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));
        }
 public void Invoke()
 {
     if (Scheduler == null)
     {
         if (_executionContext == null)
         {
             _action(_state);
         }
         else
         {
             ExecutionContextEx.Run(_executionContext, s_executionContextCallback, this);
         }
     }
     else
     {
         Scheduler.UnsafeSchedule(s_schedulerCallback, this);
     }
 }
Exemple #3
0
 public void AddContinuation(Action <object> continuation, object state, FutureScheduler scheduler = null)
 {
     AddContinuation(new PromiseContinuation(continuation, state, scheduler, ExecutionContextEx.Capture()));
 }