more strict handle cancel timing on asyncOperation.WithCancellation()
parent
9d3b7adc8e
commit
c2824027d4
|
@ -134,6 +134,12 @@ namespace Cysharp.Threading.Tasks
|
|||
else
|
||||
{
|
||||
completed = true;
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
core.TrySetCanceled(cancellationToken);
|
||||
return;
|
||||
}
|
||||
|
||||
core.TrySetResult(AsyncUnit.Default);
|
||||
}
|
||||
}
|
||||
|
@ -420,6 +426,12 @@ namespace Cysharp.Threading.Tasks
|
|||
else
|
||||
{
|
||||
completed = true;
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
core.TrySetCanceled(cancellationToken);
|
||||
return;
|
||||
}
|
||||
|
||||
core.TrySetResult(asyncOperation.asset);
|
||||
}
|
||||
}
|
||||
|
@ -714,6 +726,12 @@ namespace Cysharp.Threading.Tasks
|
|||
else
|
||||
{
|
||||
completed = true;
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
core.TrySetCanceled(cancellationToken);
|
||||
return;
|
||||
}
|
||||
|
||||
core.TrySetResult(asyncOperation.asset);
|
||||
}
|
||||
}
|
||||
|
@ -1008,6 +1026,12 @@ namespace Cysharp.Threading.Tasks
|
|||
else
|
||||
{
|
||||
completed = true;
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
core.TrySetCanceled(cancellationToken);
|
||||
return;
|
||||
}
|
||||
|
||||
core.TrySetResult(asyncOperation.assetBundle);
|
||||
}
|
||||
}
|
||||
|
@ -1325,6 +1349,12 @@ namespace Cysharp.Threading.Tasks
|
|||
else
|
||||
{
|
||||
completed = true;
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
core.TrySetCanceled(cancellationToken);
|
||||
return;
|
||||
}
|
||||
|
||||
var result = asyncOperation.webRequest;
|
||||
if (result.IsError())
|
||||
{
|
||||
|
|
|
@ -205,6 +205,12 @@ namespace Cysharp.Threading.Tasks
|
|||
else
|
||||
{
|
||||
completed = true;
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
{
|
||||
core.TrySetCanceled(cancellationToken);
|
||||
return;
|
||||
}
|
||||
|
||||
<# if(IsUnityWebRequest(t)) { #>
|
||||
var result = asyncOperation.webRequest;
|
||||
if (result.IsError())
|
||||
|
|
Loading…
Reference in New Issue