internal Action GetCompletionAction <TMethodBuilder, TStateMachine>(ref TMethodBuilder builder, ref TStateMachine stateMachine) where TMethodBuilder : IAsyncMethodBuilder where TStateMachine : IAsyncStateMachine { ExecutionContextLightup context = ExecutionContextLightup.Instance.Capture(); AsyncMethodBuilderCore.MoveNextRunner moveNextRunner = new AsyncMethodBuilderCore.MoveNextRunner(context); Action result = new Action(moveNextRunner.Run); if (m_stateMachine == null) { builder.PreBoxInitialization(); m_stateMachine = stateMachine; m_stateMachine.SetStateMachine(m_stateMachine); } moveNextRunner.m_stateMachine = m_stateMachine; return(result); }
internal MoveNextRunner(ExecutionContextLightup context) { m_context = context; }
internal void Run(ExecutionContextLightup m_context, Action <object> callback, object state) { callback(state); }