Example #1
0
 public static PromiseMethodBuilder Create()
 {
     Internal.ValidateThreadAccess(1);
     return(new PromiseMethodBuilder()
     {
         _promise = AsyncPromise.GetOrCreate()
     });
 }
Example #2
0
        private Action GetContinuation <TStateMachine>(ref TStateMachine stateMachine)
            where TStateMachine : IAsyncStateMachine
        {
            if (Task is null)
            {
                var promise = AsyncPromise <TStateMachine> .GetOrCreate();

                // ORDER VERY IMPORTANT, Task must be set before copying stateMachine.
                Task = promise;
                promise.stateMachine = stateMachine;
                return(promise.continuation);
            }
            return(((AsyncPromise)Task).continuation);
        }