From 0ec45b9da6ee20141e4179a52add4c69d7c40e11 Mon Sep 17 00:00:00 2001 From: neuecc Date: Thu, 25 Feb 2021 21:56:34 +0900 Subject: [PATCH] (Breaking Changed)UniTask.WithCancellation -> IgnoreWhenCanceled --- .../UniTask/Runtime/UniTaskExtensions.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs index aed4a17..c26125a 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/UniTaskExtensions.cs @@ -192,7 +192,7 @@ namespace Cysharp.Threading.Tasks /// /// Ignore task result when cancel raised first. /// - public static UniTask WithCancellation(this UniTask task, CancellationToken cancellationToken) + public static UniTask IgnoreWhenCanceled(this UniTask task, CancellationToken cancellationToken) { if (!cancellationToken.CanBeCanceled) { @@ -209,13 +209,13 @@ namespace Cysharp.Threading.Tasks return task; } - return new UniTask(new WithCancellationSource(task, cancellationToken), 0); + return new UniTask(new IgnoreWhenCanceledSource(task, cancellationToken), 0); } /// /// Ignore task result when cancel raised first. /// - public static UniTask WithCancellation(this UniTask task, CancellationToken cancellationToken) + public static UniTask IgnoreWhenCanceled(this UniTask task, CancellationToken cancellationToken) { if (!cancellationToken.CanBeCanceled) { @@ -232,10 +232,10 @@ namespace Cysharp.Threading.Tasks return task; } - return new UniTask(new WithCancellationSource(task, cancellationToken), 0); + return new UniTask(new IgnoreWhenCanceledSource(task, cancellationToken), 0); } - sealed class WithCancellationSource : IUniTaskSource + sealed class IgnoreWhenCanceledSource : IUniTaskSource { static readonly Action cancellationCallbackDelegate = CancellationCallback; @@ -243,7 +243,7 @@ namespace Cysharp.Threading.Tasks CancellationTokenRegistration tokenRegistration; UniTaskCompletionSourceCore core; - public WithCancellationSource(UniTask task, CancellationToken cancellationToken) + public IgnoreWhenCanceledSource(UniTask task, CancellationToken cancellationToken) { this.cancellationToken = cancellationToken; this.tokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallbackDelegate, this); @@ -269,7 +269,7 @@ namespace Cysharp.Threading.Tasks static void CancellationCallback(object state) { - var self = (WithCancellationSource)state; + var self = (IgnoreWhenCanceledSource)state; self.core.TrySetCanceled(self.cancellationToken); } @@ -294,7 +294,7 @@ namespace Cysharp.Threading.Tasks } } - sealed class WithCancellationSource : IUniTaskSource + sealed class IgnoreWhenCanceledSource : IUniTaskSource { static readonly Action cancellationCallbackDelegate = CancellationCallback; @@ -302,7 +302,7 @@ namespace Cysharp.Threading.Tasks CancellationTokenRegistration tokenRegistration; UniTaskCompletionSourceCore core; - public WithCancellationSource(UniTask task, CancellationToken cancellationToken) + public IgnoreWhenCanceledSource(UniTask task, CancellationToken cancellationToken) { this.cancellationToken = cancellationToken; this.tokenRegistration = cancellationToken.RegisterWithoutCaptureExecutionContext(cancellationCallbackDelegate, this); @@ -327,7 +327,7 @@ namespace Cysharp.Threading.Tasks static void CancellationCallback(object state) { - var self = (WithCancellationSource)state; + var self = (IgnoreWhenCanceledSource)state; self.core.TrySetCanceled(self.cancellationToken); }