Removed Timeout(bool ignoreTimeScale), changed to Timeout(DelayType delayType)
parent
ab76098895
commit
3ed6e28a00
|
@ -201,10 +201,10 @@ namespace Cysharp.Threading.Tasks
|
||||||
return new ToCoroutineEnumerator(task, exceptionHandler);
|
return new ToCoroutineEnumerator(task, exceptionHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async UniTask Timeout(this UniTask task, TimeSpan timeout, bool ignoreTimeScale = true, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null)
|
public static async UniTask Timeout(this UniTask task, TimeSpan timeout, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null)
|
||||||
{
|
{
|
||||||
var delayCancellationTokenSource = new CancellationTokenSource();
|
var delayCancellationTokenSource = new CancellationTokenSource();
|
||||||
var timeoutTask = UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();
|
var timeoutTask = UniTask.Delay(timeout, delayType, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();
|
||||||
|
|
||||||
int winArgIndex;
|
int winArgIndex;
|
||||||
bool taskResultIsCanceled;
|
bool taskResultIsCanceled;
|
||||||
|
@ -242,10 +242,10 @@ namespace Cysharp.Threading.Tasks
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async UniTask<T> Timeout<T>(this UniTask<T> task, TimeSpan timeout, bool ignoreTimeScale = true, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null)
|
public static async UniTask<T> Timeout<T>(this UniTask<T> task, TimeSpan timeout, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null)
|
||||||
{
|
{
|
||||||
var delayCancellationTokenSource = new CancellationTokenSource();
|
var delayCancellationTokenSource = new CancellationTokenSource();
|
||||||
var timeoutTask = UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();
|
var timeoutTask = UniTask.Delay(timeout, delayType, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();
|
||||||
|
|
||||||
int winArgIndex;
|
int winArgIndex;
|
||||||
(bool IsCanceled, T Result) taskResult;
|
(bool IsCanceled, T Result) taskResult;
|
||||||
|
@ -288,10 +288,10 @@ namespace Cysharp.Threading.Tasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Timeout with suppress OperationCanceledException. Returns (bool, IsCacneled).
|
/// Timeout with suppress OperationCanceledException. Returns (bool, IsCacneled).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async UniTask<bool> TimeoutWithoutException(this UniTask task, TimeSpan timeout, bool ignoreTimeScale = true, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null)
|
public static async UniTask<bool> TimeoutWithoutException(this UniTask task, TimeSpan timeout, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null)
|
||||||
{
|
{
|
||||||
var delayCancellationTokenSource = new CancellationTokenSource();
|
var delayCancellationTokenSource = new CancellationTokenSource();
|
||||||
var timeoutTask = UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();
|
var timeoutTask = UniTask.Delay(timeout, delayType, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();
|
||||||
|
|
||||||
int winArgIndex;
|
int winArgIndex;
|
||||||
bool taskResultIsCanceled;
|
bool taskResultIsCanceled;
|
||||||
|
@ -334,10 +334,10 @@ namespace Cysharp.Threading.Tasks
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Timeout with suppress OperationCanceledException. Returns (bool IsTimeout, T Result).
|
/// Timeout with suppress OperationCanceledException. Returns (bool IsTimeout, T Result).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static async UniTask<(bool IsTimeout, T Result)> TimeoutWithoutException<T>(this UniTask<T> task, TimeSpan timeout, bool ignoreTimeScale = true, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null)
|
public static async UniTask<(bool IsTimeout, T Result)> TimeoutWithoutException<T>(this UniTask<T> task, TimeSpan timeout, DelayType delayType = DelayType.DeltaTime, PlayerLoopTiming timeoutCheckTiming = PlayerLoopTiming.Update, CancellationTokenSource taskCancellationTokenSource = null)
|
||||||
{
|
{
|
||||||
var delayCancellationTokenSource = new CancellationTokenSource();
|
var delayCancellationTokenSource = new CancellationTokenSource();
|
||||||
var timeoutTask = UniTask.Delay(timeout, ignoreTimeScale, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();
|
var timeoutTask = UniTask.Delay(timeout, delayType, timeoutCheckTiming, delayCancellationTokenSource.Token).SuppressCancellationThrow();
|
||||||
|
|
||||||
int winArgIndex;
|
int winArgIndex;
|
||||||
(bool IsCanceled, T Result) taskResult;
|
(bool IsCanceled, T Result) taskResult;
|
||||||
|
|
|
@ -434,6 +434,8 @@ public class SandboxMain : MonoBehaviour
|
||||||
throw new Exception("yeah");
|
throw new Exception("yeah");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
@ -442,6 +444,9 @@ public class SandboxMain : MonoBehaviour
|
||||||
|
|
||||||
UnityEngine.Debug.Log("Start:" + PlayerLoopInfo.CurrentLoopType);
|
UnityEngine.Debug.Log("Start:" + PlayerLoopInfo.CurrentLoopType);
|
||||||
|
|
||||||
|
|
||||||
|
// this.GetCancellationTokenOnDestroy()
|
||||||
|
|
||||||
//PlayerLoopInfo.Inject();
|
//PlayerLoopInfo.Inject();
|
||||||
|
|
||||||
//_ = AsyncFixedUpdate();
|
//_ = AsyncFixedUpdate();
|
||||||
|
@ -458,7 +463,11 @@ public class SandboxMain : MonoBehaviour
|
||||||
//var cts = new CancellationTokenSource();
|
//var cts = new CancellationTokenSource();
|
||||||
|
|
||||||
|
|
||||||
|
// UniTask.Post(
|
||||||
|
|
||||||
|
// CancellationToken.
|
||||||
|
|
||||||
|
//UniTask.Delay(TimeSpan.FromSeconds(3)).
|
||||||
|
|
||||||
|
|
||||||
//okButton.onClick.AddListener(UniTask.UnityAction(async () =>
|
//okButton.onClick.AddListener(UniTask.UnityAction(async () =>
|
||||||
|
|
Loading…
Reference in New Issue