fix can not close application in mono build

master
neuecc 2020-06-17 21:37:45 +09:00
parent 5bfff5bc24
commit bdd569e213
18 changed files with 106 additions and 523 deletions

View File

@ -143,14 +143,6 @@ namespace Cysharp.Threading.Tasks
return pool.TryPush(this); return pool.TryPush(this);
} }
~WaitAsyncSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
static void CancellationCallback(object state) static void CancellationCallback(object state)
{ {
var self = (WaitAsyncSource)state; var self = (WaitAsyncSource)state;
@ -468,14 +460,6 @@ namespace Cysharp.Threading.Tasks
return pool.TryPush(this); return pool.TryPush(this);
} }
~WaitAsyncSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
static void CancellationCallback(object state) static void CancellationCallback(object state)
{ {
var self = (WaitAsyncSource)state; var self = (WaitAsyncSource)state;

View File

@ -239,14 +239,6 @@ namespace Cysharp.Threading.Tasks.CompilerServices
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~AsyncUniTask()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
internal sealed class AsyncUniTask<TStateMachine, T> : IStateMachineRunnerPromise<T>, IUniTaskSource<T>, ITaskPoolNode<AsyncUniTask<TStateMachine, T>> internal sealed class AsyncUniTask<TStateMachine, T> : IStateMachineRunnerPromise<T>, IUniTaskSource<T>, ITaskPoolNode<AsyncUniTask<TStateMachine, T>>
@ -376,14 +368,6 @@ namespace Cysharp.Threading.Tasks.CompilerServices
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~AsyncUniTask()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
} }

View File

@ -134,14 +134,6 @@ namespace Cysharp.Threading.Tasks
return pool.TryPush(this); return pool.TryPush(this);
} }
~EnumeratorPromise()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
// Unwrap YieldInstructions // Unwrap YieldInstructions
static IEnumerator ConsumeEnumerator(IEnumerator enumerator) static IEnumerator ConsumeEnumerator(IEnumerator enumerator)

View File

@ -193,14 +193,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~AsyncOperationHandleWithCancellationSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class AsyncOperationHandleConfiguredSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationHandleConfiguredSource> sealed class AsyncOperationHandleConfiguredSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationHandleConfiguredSource>
@ -314,14 +306,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~AsyncOperationHandleConfiguredSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
#endregion #endregion
@ -512,14 +496,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~AsyncOperationHandleWithCancellationSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class AsyncOperationHandleConfiguredSource<T> : IUniTaskSource<T>, IPlayerLoopItem, ITaskPoolNode<AsyncOperationHandleConfiguredSource<T>> sealed class AsyncOperationHandleConfiguredSource<T> : IUniTaskSource<T>, IPlayerLoopItem, ITaskPoolNode<AsyncOperationHandleConfiguredSource<T>>
@ -637,14 +613,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~AsyncOperationHandleConfiguredSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
#endregion #endregion

View File

@ -278,14 +278,6 @@ namespace Cysharp.Threading.Tasks
originalUpdateAction = default; originalUpdateAction = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~TweenConfiguredSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
} }

View File

@ -1,6 +1,7 @@
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
using System; using System;
using System.IO;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading; using System.Threading;
using UnityEngine; using UnityEngine;
@ -181,14 +182,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~YieldPromise()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class NextFramePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<NextFramePromise> sealed class NextFramePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<NextFramePromise>
@ -283,14 +276,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~NextFramePromise()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class DelayFramePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayFramePromise> sealed class DelayFramePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayFramePromise>
@ -406,14 +391,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~DelayFramePromise()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class DelayPromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayPromise> sealed class DelayPromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayPromise>
@ -524,14 +501,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~DelayPromise()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class DelayIgnoreTimeScalePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayIgnoreTimeScalePromise> sealed class DelayIgnoreTimeScalePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<DelayIgnoreTimeScalePromise>
@ -642,14 +611,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~DelayIgnoreTimeScalePromise()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
} }

View File

@ -137,14 +137,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~WaitUntilPromise()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class WaitWhilePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<WaitWhilePromise> sealed class WaitWhilePromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<WaitWhilePromise>
@ -249,14 +241,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~WaitWhilePromise()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class WaitUntilCanceledPromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<WaitUntilCanceledPromise> sealed class WaitUntilCanceledPromise : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<WaitUntilCanceledPromise>
@ -344,14 +328,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~WaitUntilCanceledPromise()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
// where T : UnityEngine.Object, can not add constraint // where T : UnityEngine.Object, can not add constraint
@ -475,14 +451,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~WaitUntilValueChangedUnityObjectPromise()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class WaitUntilValueChangedStandardObjectPromise<T, U> : IUniTaskSource<U>, IPlayerLoopItem, ITaskPoolNode<WaitUntilValueChangedStandardObjectPromise<T, U>> sealed class WaitUntilValueChangedStandardObjectPromise<T, U> : IUniTaskSource<U>, IPlayerLoopItem, ITaskPoolNode<WaitUntilValueChangedStandardObjectPromise<T, U>>
@ -604,14 +572,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~WaitUntilValueChangedStandardObjectPromise()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
} }
} }

View File

@ -131,11 +131,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3)> WhenAll<T1, T2, T3>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3) public static UniTask<(T1, T2, T3)> WhenAll<T1, T2, T3>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3)
@ -295,11 +290,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3, T4)> WhenAll<T1, T2, T3, T4>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4) public static UniTask<(T1, T2, T3, T4)> WhenAll<T1, T2, T3, T4>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4)
@ -495,11 +485,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3, T4, T5)> WhenAll<T1, T2, T3, T4, T5>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5) public static UniTask<(T1, T2, T3, T4, T5)> WhenAll<T1, T2, T3, T4, T5>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5)
@ -731,11 +716,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3, T4, T5, T6)> WhenAll<T1, T2, T3, T4, T5, T6>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6) public static UniTask<(T1, T2, T3, T4, T5, T6)> WhenAll<T1, T2, T3, T4, T5, T6>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6)
@ -1003,11 +983,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3, T4, T5, T6, T7)> WhenAll<T1, T2, T3, T4, T5, T6, T7>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7) public static UniTask<(T1, T2, T3, T4, T5, T6, T7)> WhenAll<T1, T2, T3, T4, T5, T6, T7>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7)
@ -1311,11 +1286,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8) public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8)
@ -1655,11 +1625,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9) public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9)
@ -2035,11 +2000,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10) public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10)
@ -2451,11 +2411,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11) public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11)
@ -2903,11 +2858,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12) public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12)
@ -3391,11 +3341,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13) public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13)
@ -3915,11 +3860,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14) public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14)
@ -4475,11 +4415,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14, UniTask<T15> task15) public static UniTask<(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15)> WhenAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14, UniTask<T15> task15)
@ -5071,11 +5006,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
} }
} }

View File

@ -45,7 +45,7 @@ namespace Cysharp.Threading.Tasks
public WhenAllPromise(<#= args #>) public WhenAllPromise(<#= args #>)
{ {
TaskTracker2.TrackActiveTask(this, 3); TaskTracker.TrackActiveTask(this, 3);
this.completedCount = 0; this.completedCount = 0;
<# for(var j = 1; j <= i; j++) { #> <# for(var j = 1; j <= i; j++) { #>
@ -92,7 +92,7 @@ namespace Cysharp.Threading.Tasks
public (<#= t #>) GetResult(short token) public (<#= t #>) GetResult(short token)
{ {
TaskTracker2.RemoveTracking(this); TaskTracker.RemoveTracking(this);
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
return core.GetResult(token); return core.GetResult(token);
} }
@ -116,11 +116,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
<# } #> <# } #>
} }

View File

@ -142,11 +142,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
sealed class WhenAllPromise : IUniTaskSource sealed class WhenAllPromise : IUniTaskSource
@ -237,11 +232,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~WhenAllPromise()
{
core.Reset();
}
} }
} }
} }

View File

@ -127,11 +127,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3)> WhenAny<T1, T2, T3>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3)> WhenAny<T1, T2, T3>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3)
@ -289,11 +284,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4)> WhenAny<T1, T2, T3, T4>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4)> WhenAny<T1, T2, T3, T4>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4)
@ -488,11 +478,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5)> WhenAny<T1, T2, T3, T4, T5>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5)> WhenAny<T1, T2, T3, T4, T5>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5)
@ -724,11 +709,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6)> WhenAny<T1, T2, T3, T4, T5, T6>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6)> WhenAny<T1, T2, T3, T4, T5, T6>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6)
@ -997,11 +977,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7)> WhenAny<T1, T2, T3, T4, T5, T6, T7>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7)> WhenAny<T1, T2, T3, T4, T5, T6, T7>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7)
@ -1307,11 +1282,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8)
@ -1654,11 +1624,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9)
@ -2038,11 +2003,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10)
@ -2459,11 +2419,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11)
@ -2917,11 +2872,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12)
@ -3412,11 +3362,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13)
@ -3944,11 +3889,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14)
@ -4513,11 +4453,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14, T15 result15)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14, UniTask<T15> task15) public static UniTask<(int winArgumentIndex, T1 result1, T2 result2, T3 result3, T4 result4, T5 result5, T6 result6, T7 result7, T8 result8, T9 result9, T10 result10, T11 result11, T12 result12, T13 result13, T14 result14, T15 result15)> WhenAny<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(UniTask<T1> task1, UniTask<T2> task2, UniTask<T3> task3, UniTask<T4> task4, UniTask<T5> task5, UniTask<T6> task6, UniTask<T7> task7, UniTask<T8> task8, UniTask<T9> task9, UniTask<T10> task10, UniTask<T11> task11, UniTask<T12> task12, UniTask<T13> task13, UniTask<T14> task14, UniTask<T15> task15)
@ -5119,11 +5054,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
} }

View File

@ -37,7 +37,7 @@ namespace Cysharp.Threading.Tasks
public WhenAnyPromise(<#= args #>) public WhenAnyPromise(<#= args #>)
{ {
TaskTracker2.TrackActiveTask(this, 3); TaskTracker.TrackActiveTask(this, 3);
this.completedCount = 0; this.completedCount = 0;
<# for(var j = 1; j <= i; j++) { #> <# for(var j = 1; j <= i; j++) { #>
@ -86,7 +86,7 @@ namespace Cysharp.Threading.Tasks
public (int, <#= tBool #>) GetResult(short token) public (int, <#= tBool #>) GetResult(short token)
{ {
TaskTracker2.RemoveTracking(this); TaskTracker.RemoveTracking(this);
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
return core.GetResult(token); return core.GetResult(token);
} }
@ -110,11 +110,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
<# } #> <# } #>

View File

@ -171,11 +171,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyLRPromise()
{
core.Reset();
}
} }
@ -268,11 +263,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
sealed class WhenAnyPromise : IUniTaskSource<int> sealed class WhenAnyPromise : IUniTaskSource<int>
@ -363,11 +353,6 @@ namespace Cysharp.Threading.Tasks
{ {
GetResult(token); GetResult(token);
} }
~WhenAnyPromise()
{
core.Reset();
}
} }
} }
} }

View File

@ -38,13 +38,42 @@ namespace Cysharp.Threading.Tasks
{ {
} }
internal class ExceptionHolder
{
ExceptionDispatchInfo exception;
bool calledGet = false;
public ExceptionHolder(ExceptionDispatchInfo exception)
{
this.exception = exception;
}
public ExceptionDispatchInfo GetException()
{
if (!calledGet)
{
calledGet = true;
GC.SuppressFinalize(this);
}
return exception;
}
~ExceptionHolder()
{
if (!calledGet)
{
UniTaskScheduler.PublishUnobservedTaskException(exception.SourceException);
}
}
}
[StructLayout(LayoutKind.Auto)] [StructLayout(LayoutKind.Auto)]
public struct UniTaskCompletionSourceCore<TResult> public struct UniTaskCompletionSourceCore<TResult>
{ {
// Struct Size: TResult + (8 + 2 + 1 + 1 + 8 + 8) // Struct Size: TResult + (8 + 2 + 1 + 1 + 8 + 8)
TResult result; TResult result;
object error; // ExceptionDispatchInfo or OperationCanceledException object error; // ExceptionHolder or OperationCanceledException
short version; short version;
bool hasUnhandledError; bool hasUnhandledError;
int completedCount; // 0: completed == false int completedCount; // 0: completed == false
@ -78,9 +107,9 @@ namespace Cysharp.Threading.Tasks
{ {
UniTaskScheduler.PublishUnobservedTaskException(oc); UniTaskScheduler.PublishUnobservedTaskException(oc);
} }
else if (error is ExceptionDispatchInfo ei) else if (error is ExceptionHolder e)
{ {
UniTaskScheduler.PublishUnobservedTaskException(ei.SourceException); UniTaskScheduler.PublishUnobservedTaskException(e.GetException().SourceException);
} }
} }
catch catch
@ -129,7 +158,7 @@ namespace Cysharp.Threading.Tasks
} }
else else
{ {
this.error = ExceptionDispatchInfo.Capture(error); this.error = new ExceptionHolder(ExceptionDispatchInfo.Capture(error));
} }
if (continuation != null || Interlocked.CompareExchange(ref this.continuation, UniTaskCompletionSourceCoreShared.s_sentinel, null) != null) if (continuation != null || Interlocked.CompareExchange(ref this.continuation, UniTaskCompletionSourceCoreShared.s_sentinel, null) != null)
@ -209,9 +238,9 @@ namespace Cysharp.Threading.Tasks
{ {
throw oce; throw oce;
} }
else if (error is ExceptionDispatchInfo edi) else if (error is ExceptionHolder eh)
{ {
edi.Throw(); eh.GetException().Throw();
} }
throw new InvalidOperationException("Critical: invalid exception type was held."); throw new InvalidOperationException("Critical: invalid exception type was held.");
@ -367,12 +396,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~UniTaskCompletionSource()
{
// clear error information.
core.Reset();
}
} }
public class AutoResetUniTaskCompletionSource : IUniTaskSource, ITaskPoolNode<AutoResetUniTaskCompletionSource>, IPromise public class AutoResetUniTaskCompletionSource : IUniTaskSource, ITaskPoolNode<AutoResetUniTaskCompletionSource>, IPromise
@ -495,15 +518,6 @@ namespace Cysharp.Threading.Tasks
core.Reset(); core.Reset();
return pool.TryPush(this); return pool.TryPush(this);
} }
~AutoResetUniTaskCompletionSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
return;
}
}
} }
public class UniTaskCompletionSource<T> : IUniTaskSource<T>, IPromise<T> public class UniTaskCompletionSource<T> : IUniTaskSource<T>, IPromise<T>
@ -593,12 +607,6 @@ namespace Cysharp.Threading.Tasks
{ {
core.OnCompleted(continuation, state, token); core.OnCompleted(continuation, state, token);
} }
~UniTaskCompletionSource()
{
// clear error information.
core.Reset();
}
} }
public class AutoResetUniTaskCompletionSource<T> : IUniTaskSource<T>, ITaskPoolNode<AutoResetUniTaskCompletionSource<T>>, IPromise<T> public class AutoResetUniTaskCompletionSource<T> : IUniTaskSource<T>, ITaskPoolNode<AutoResetUniTaskCompletionSource<T>>, IPromise<T>
@ -726,15 +734,6 @@ namespace Cysharp.Threading.Tasks
core.Reset(); core.Reset();
return pool.TryPush(this); return pool.TryPush(this);
} }
~AutoResetUniTaskCompletionSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
} }

View File

@ -185,14 +185,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~AsyncOperationWithCancellationSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class AsyncOperationConfiguredSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationConfiguredSource> sealed class AsyncOperationConfiguredSource : IUniTaskSource, IPlayerLoopItem, ITaskPoolNode<AsyncOperationConfiguredSource>
@ -299,14 +291,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~AsyncOperationConfiguredSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
#endregion #endregion
@ -491,14 +475,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~ResourceRequestWithCancellationSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class ResourceRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<ResourceRequestConfiguredSource> sealed class ResourceRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<ResourceRequestConfiguredSource>
@ -609,14 +585,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~ResourceRequestConfiguredSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
#endregion #endregion
@ -801,14 +769,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~AssetBundleRequestWithCancellationSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class AssetBundleRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestConfiguredSource> sealed class AssetBundleRequestConfiguredSource : IUniTaskSource<UnityEngine.Object>, IPlayerLoopItem, ITaskPoolNode<AssetBundleRequestConfiguredSource>
@ -919,14 +879,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~AssetBundleRequestConfiguredSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
#endregion #endregion
@ -1111,14 +1063,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~AssetBundleCreateRequestWithCancellationSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class AssetBundleCreateRequestConfiguredSource : IUniTaskSource<AssetBundle>, IPlayerLoopItem, ITaskPoolNode<AssetBundleCreateRequestConfiguredSource> sealed class AssetBundleCreateRequestConfiguredSource : IUniTaskSource<AssetBundle>, IPlayerLoopItem, ITaskPoolNode<AssetBundleCreateRequestConfiguredSource>
@ -1229,14 +1173,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~AssetBundleCreateRequestConfiguredSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
#endregion #endregion
@ -1439,14 +1375,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~UnityWebRequestAsyncOperationWithCancellationSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class UnityWebRequestAsyncOperationConfiguredSource : IUniTaskSource<UnityWebRequest>, IPlayerLoopItem, ITaskPoolNode<UnityWebRequestAsyncOperationConfiguredSource> sealed class UnityWebRequestAsyncOperationConfiguredSource : IUniTaskSource<UnityWebRequest>, IPlayerLoopItem, ITaskPoolNode<UnityWebRequestAsyncOperationConfiguredSource>
@ -1565,14 +1493,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~UnityWebRequestAsyncOperationConfiguredSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
#endregion #endregion

View File

@ -258,14 +258,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~<#= t.typeName #>WithCancellationSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
sealed class <#= t.typeName #>ConfiguredSource : <#= ToIUniTaskSourceReturnType(t.returnType) #>, IPlayerLoopItem, ITaskPoolNode<<#= t.typeName #>ConfiguredSource> sealed class <#= t.typeName #>ConfiguredSource : <#= ToIUniTaskSourceReturnType(t.returnType) #>, IPlayerLoopItem, ITaskPoolNode<<#= t.typeName #>ConfiguredSource>
@ -396,14 +388,6 @@ namespace Cysharp.Threading.Tasks
cancellationToken = default; cancellationToken = default;
return pool.TryPush(this); return pool.TryPush(this);
} }
~<#= t.typeName #>ConfiguredSource()
{
if (TryReturn())
{
GC.ReRegisterForFinalize(this);
}
}
} }
#endregion #endregion

View File

@ -184,6 +184,7 @@ public class SandboxMain : MonoBehaviour
} }
async UniTask RunStandardDelayAsync() async UniTask RunStandardDelayAsync()
{ {
UnityEngine.Debug.Log("DEB"); UnityEngine.Debug.Log("DEB");
@ -422,10 +423,23 @@ public class SandboxMain : MonoBehaviour
Debug.Log($"{v.isDone} {v.isHttpError} {v.isNetworkError}"); Debug.Log($"{v.isDone} {v.isHttpError} {v.isNetworkError}");
Debug.Log(v.downloadHandler.text); Debug.Log(v.downloadHandler.text);
} }
private async void Go()
{
await UniTask.DelayFrame(0);
}
async UniTask Foo()
{
await UniTask.DelayFrame(10);
throw new Exception("yeah");
}
void Start() void Start()
{ {
_ = Foo(); // unhandled.
Go();
UnityEngine.Debug.Log("Start:" + PlayerLoopInfo.CurrentLoopType); UnityEngine.Debug.Log("Start:" + PlayerLoopInfo.CurrentLoopType);
//PlayerLoopInfo.Inject(); //PlayerLoopInfo.Inject();
@ -441,76 +455,76 @@ public class SandboxMain : MonoBehaviour
// rp.AddTo(this.GetCancellationTokenOnDestroy()); // rp.AddTo(this.GetCancellationTokenOnDestroy());
var cts = new CancellationTokenSource();
okButton.onClick.AddListener(UniTask.UnityAction(async () =>
{
_ = ExecuteAsync();
await UniTask.Yield();
//await DelayCheck();
/*
UnityEngine.Debug.Log("click:" + PlayerLoopInfo.CurrentLoopType);
StartCoroutine(CoroutineRun());
StartCoroutine(CoroutineRun2());
_ = AsyncRun();
_ = AsyncLastUpdate();
_ = AsyncLastLast();
*/
//await UniTask.Yield();
//_ = Test2();
// EarlyUpdate.ExecuteMainThreadJobs
// _ = Test2();
//var t = await Resources.LoadAsync<TextAsset>(Application.streamingAssetsPath + "test.txt");
//Debug.Log("LoadEnd" + PlayerLoopInfo.CurrentLoopType + ", " + (t != null));
//Debug.Log("LoadEnd" + PlayerLoopInfo.CurrentLoopType + ", " + ((TextAsset)t).text);
//await UniTask.Yield(PlayerLoopTiming.LastUpdate);
//UnityEngine.Debug.Log("after update:" + Time.frameCount);
////await UniTask.NextFrame();
////await UniTask.Yield();
////UnityEngine.Debug.Log("after update nextframe:" + Time.frameCount);
//StartCoroutine(CoroutineRun2());
////StartCoroutine(CoroutineRun());
//UnityEngine.Debug.Log("FOO?");
//_ = DelayFrame3_Pre();
//await UniTask.Yield();
}));
cancelButton.onClick.AddListener(UniTask.UnityAction(async () =>
{
_ = DelayFrame3_Post();
await UniTask.Yield();
//await UniTask.Yield(PlayerLoopTiming.LastPreUpdate);
//UnityEngine.Debug.Log("before update:" + Time.frameCount);
//await UniTask.NextFrame();
//await UniTask.Yield();
//UnityEngine.Debug.Log("before update nextframe:" + Time.frameCount);
//StartCoroutine(CoroutineRun());
//UnityEngine.Debug.Log("click:" + PlayerLoopInfo.CurrentLoopType);
//_ = Yieldding();
//var cts = new CancellationTokenSource(); //var cts = new CancellationTokenSource();
//UnityEngine.Debug.Log("click:" + PlayerLoopInfo.CurrentLoopType + ":" + Time.frameCount);
//var la = SceneManager.LoadSceneAsync("Scenes/ExceptionExamples").WithCancellation(cts.Token);
////cts.Cancel();
//await la;
//UnityEngine.Debug.Log("End LoadSceneAsync" + PlayerLoopInfo.CurrentLoopType + ":" + Time.frameCount); //okButton.onClick.AddListener(UniTask.UnityAction(async () =>
})); //{
// _ = ExecuteAsync();
// await UniTask.Yield();
// //await DelayCheck();
// /*
// UnityEngine.Debug.Log("click:" + PlayerLoopInfo.CurrentLoopType);
// StartCoroutine(CoroutineRun());
// StartCoroutine(CoroutineRun2());
// _ = AsyncRun();
// _ = AsyncLastUpdate();
// _ = AsyncLastLast();
// */
// //await UniTask.Yield();
// //_ = Test2();
// // EarlyUpdate.ExecuteMainThreadJobs
// // _ = Test2();
// //var t = await Resources.LoadAsync<TextAsset>(Application.streamingAssetsPath + "test.txt");
// //Debug.Log("LoadEnd" + PlayerLoopInfo.CurrentLoopType + ", " + (t != null));
// //Debug.Log("LoadEnd" + PlayerLoopInfo.CurrentLoopType + ", " + ((TextAsset)t).text);
// //await UniTask.Yield(PlayerLoopTiming.LastUpdate);
// //UnityEngine.Debug.Log("after update:" + Time.frameCount);
// ////await UniTask.NextFrame();
// ////await UniTask.Yield();
// ////UnityEngine.Debug.Log("after update nextframe:" + Time.frameCount);
// //StartCoroutine(CoroutineRun2());
// ////StartCoroutine(CoroutineRun());
// //UnityEngine.Debug.Log("FOO?");
// //_ = DelayFrame3_Pre();
// //await UniTask.Yield();
//}));
//cancelButton.onClick.AddListener(UniTask.UnityAction(async () =>
//{
// _ = DelayFrame3_Post();
// await UniTask.Yield();
// //await UniTask.Yield(PlayerLoopTiming.LastPreUpdate);
// //UnityEngine.Debug.Log("before update:" + Time.frameCount);
// //await UniTask.NextFrame();
// //await UniTask.Yield();
// //UnityEngine.Debug.Log("before update nextframe:" + Time.frameCount);
// //StartCoroutine(CoroutineRun());
// //UnityEngine.Debug.Log("click:" + PlayerLoopInfo.CurrentLoopType);
// //_ = Yieldding();
// //var cts = new CancellationTokenSource();
// //UnityEngine.Debug.Log("click:" + PlayerLoopInfo.CurrentLoopType + ":" + Time.frameCount);
// //var la = SceneManager.LoadSceneAsync("Scenes/ExceptionExamples").WithCancellation(cts.Token);
// ////cts.Cancel();
// //await la;
// //UnityEngine.Debug.Log("End LoadSceneAsync" + PlayerLoopInfo.CurrentLoopType + ":" + Time.frameCount);
//}));
//return; //return;
//await UniTask.SwitchToMainThread(); //await UniTask.SwitchToMainThread();

View File

@ -557,7 +557,7 @@ PlayerSettings:
platformArchitecture: {} platformArchitecture: {}
scriptingBackend: scriptingBackend:
Android: 1 Android: 1
Standalone: 1 Standalone: 0
il2cppCompilerConfiguration: {} il2cppCompilerConfiguration: {}
managedStrippingLevel: {} managedStrippingLevel: {}
incrementalIl2cppBuild: {} incrementalIl2cppBuild: {}