From 3bad5cd2bff2a041a1c0127562211e9d47825c13 Mon Sep 17 00:00:00 2001 From: hikari Date: Tue, 25 Aug 2020 02:55:09 +0900 Subject: [PATCH] fixup! Fix ToCancellationToken linkToken --- .../Plugins/UniTask/Runtime/CancellationTokenExtensions.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenExtensions.cs b/src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenExtensions.cs index 6575432..3f3a532 100644 --- a/src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenExtensions.cs +++ b/src/UniTask/Assets/Plugins/UniTask/Runtime/CancellationTokenExtensions.cs @@ -30,10 +30,10 @@ namespace Cysharp.Threading.Tasks return ToCancellationToken(task); } - var cts = new CancellationTokenSource(); + var cts = CancellationTokenSource.CreateLinkedTokenSource(linkToken); ToCancellationTokenCore(task, cts).Forget(); - return CancellationTokenSource.CreateLinkedTokenSource(cts.Token, linkToken).Token; + return cts.Token; } public static CancellationToken ToCancellationToken(this UniTask task)