public static Routine <T> GetAwaiter <T>(this IResumer <T> resumer) { var _resumer = resumer as Resumer <T>; var resumerRoutine = Routine.Get <Routine <T> >(true); resumerRoutine.Trace(1); _resumer.routine = resumerRoutine; _resumer.id = resumerRoutine.Id; if (_resumer.WasResumed) { resumerRoutine.SetResult(_resumer.result); _resumer.Reset(); } return(resumerRoutine); }
public static Routine GetAwaiter(this IResumer resumer) { var _resumer = resumer as Resumer; Assert.IsNotNull(_resumer); var resumerRoutine = Routine.Get <Routine>(true); resumerRoutine.Trace(1); _resumer.routine = resumerRoutine; _resumer.id = resumerRoutine.Id; if (_resumer.WasResumed) { resumerRoutine.SetResult(); _resumer.Reset(); } return(resumerRoutine); }