WhenAll and WhenAny

This commit is contained in:
neuecc
2020-04-21 13:36:23 +09:00
parent 082f3e7335
commit 3654a9e2f9
16 changed files with 11143 additions and 3797 deletions

View File

@@ -96,7 +96,7 @@ namespace UniRx.Async
{
if (cancellationToken.IsCancellationRequested)
{
core.SetCanceled(cancellationToken);
core.TrySetCanceled(cancellationToken);
return false;
}
@@ -109,11 +109,11 @@ namespace UniRx.Async
}
catch (Exception ex)
{
core.SetException(ex);
core.TrySetException(ex);
return false;
}
core.SetResult(null);
core.TrySetResult(null);
return false;
}
@@ -126,6 +126,14 @@ namespace UniRx.Async
exception = default;
}
~EnumeratorPromise()
{
if (pool.TryReturn(this))
{
GC.ReRegisterForFinalize(this);
}
}
// Unwrap YieldInstructions
static IEnumerator ConsumeEnumerator(IEnumerator enumerator)