public static async AwaitableCoroutine WaitAll(AwaitableCoroutineBase c1, AwaitableCoroutineBase c2, AwaitableCoroutineBase c3, AwaitableCoroutineBase c4) { while (!(c1.IsCompleted && c2.IsCompleted && c3.IsCompleted && c4.IsCompleted)) { if (c1.IsCanceled) { AwaitableCoroutine.ThrowChildCancel <AwaitableCoroutineBase>(c1); } if (c2.IsCanceled) { AwaitableCoroutine.ThrowChildCancel <AwaitableCoroutineBase>(c2); } if (c3.IsCanceled) { AwaitableCoroutine.ThrowChildCancel <AwaitableCoroutineBase>(c3); } if (c4.IsCanceled) { AwaitableCoroutine.ThrowChildCancel <AwaitableCoroutineBase>(c4); } await Yield(); } }
public static async AwaitableCoroutine <T> WaitAny <T>(AwaitableCoroutine <T> c1, AwaitableCoroutine <T> c2, AwaitableCoroutine <T> c3, AwaitableCoroutine <T> c4, AwaitableCoroutine <T> c5, AwaitableCoroutine <T> c6) { while (true) { if (c1.IsCanceled && c2.IsCanceled && c3.IsCanceled && c4.IsCanceled && c5.IsCanceled && c6.IsCanceled) { AwaitableCoroutine.ThrowChildrenCancel <AwaitableCoroutine <T> >(new AwaitableCoroutine <T>[] { c1, c2, c3, c4, c5, c6 }); } if (c1.IsCompleted) { return(c1.Result); } if (c2.IsCompleted) { return(c2.Result); } if (c3.IsCompleted) { return(c3.Result); } if (c4.IsCompleted) { return(c4.Result); } if (c5.IsCompleted) { return(c5.Result); } if (c6.IsCompleted) { return(c6.Result); } await Yield(); } }
public static AwaitableCoroutine ToAwaitable(this IEnumerator enumerator) { return(AwaitableCoroutine.FromEnumerator(enumerator)); }
public static async AwaitableCoroutine <T> WaitAny <T>(AwaitableCoroutine <T> c1, AwaitableCoroutine <T> c2) { while (true) { if (c1.IsCompleted) { return(c1.Result); } if (c2.IsCompleted) { return(c2.Result); } if (c1.IsCanceled && c2.IsCanceled) { AwaitableCoroutine.ThrowChildrenCancel <AwaitableCoroutine <T> >(new AwaitableCoroutine <T>[] { c1, c2 }); } await Yield(); } }