mirror of https://github.com/Cysharp/UniTask
It seems that the problem has not been completely resolved just now
parent
b06f10f974
commit
9d5a4a9f5a
|
@ -792,14 +792,18 @@ namespace UniRx.Async
|
||||||
|
|
||||||
public void UnsafeOnCompleted(Action continuation)
|
public void UnsafeOnCompleted(Action continuation)
|
||||||
{
|
{
|
||||||
if(asyncOperation != null && asyncOperation.isDone)
|
|
||||||
{
|
|
||||||
continuation?.Invoke();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction);
|
Error.ThrowWhenContinuationIsAlreadyRegistered(continuationAction);
|
||||||
continuationAction = continuation.AsFuncOfT<AsyncOperation>();
|
continuationAction = continuation.AsFuncOfT<AsyncOperation>();
|
||||||
asyncOperation.completed += continuationAction;
|
lock (asyncOperation)
|
||||||
|
{
|
||||||
|
if (asyncOperation.isDone)
|
||||||
|
{
|
||||||
|
continuation?.Invoke();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
asyncOperation.completed += continuationAction;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue