Merge pull request #65 from vc-kusuha/fix_Timeout

Fix timeoutTask continues to remain.
pull/75/head
Yoshifumi Kawai 2020-04-24 14:57:05 +09:00 committed by GitHub
commit 341953b441
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -101,7 +101,7 @@ namespace UniRx.Async
// left, right both suppress operation canceled exception. // left, right both suppress operation canceled exception.
var delayCancellationTokenSource = new CancellationTokenSource(); var delayCancellationTokenSource = new CancellationTokenSource();
var timeoutTask = (UniTask)UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming).SuppressCancellationThrow(); var timeoutTask = (UniTask)UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();
var (hasValue, value) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask); var (hasValue, value) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask);
@ -147,7 +147,7 @@ namespace UniRx.Async
// left, right both suppress operation canceled exception. // left, right both suppress operation canceled exception.
var delayCancellationTokenSource = new CancellationTokenSource(); var delayCancellationTokenSource = new CancellationTokenSource();
var timeoutTask = (UniTask)UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming).SuppressCancellationThrow(); var timeoutTask = (UniTask)UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();
var (hasValue, value) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask); var (hasValue, value) = await UniTask.WhenAny(task.SuppressCancellationThrow(), timeoutTask);