master
neuecc 2020-06-09 12:16:28 +09:00
parent 859c4d706f
commit 37cd00d347
6 changed files with 25 additions and 1479 deletions

View File

@ -45,7 +45,7 @@ namespace Cysharp.Threading.Tasks.CompilerServices
{ {
static TaskPool<AsyncUniTaskVoid<TStateMachine>> pool; static TaskPool<AsyncUniTaskVoid<TStateMachine>> pool;
TStateMachine stateMachine; IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue.
public Action MoveNext { get; } public Action MoveNext { get; }
@ -113,7 +113,7 @@ namespace Cysharp.Threading.Tasks.CompilerServices
{ {
static TaskPool<AsyncUniTask<TStateMachine>> pool; static TaskPool<AsyncUniTask<TStateMachine>> pool;
TStateMachine stateMachine; IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue.
public Action MoveNext { get; } public Action MoveNext { get; }
@ -224,7 +224,7 @@ namespace Cysharp.Threading.Tasks.CompilerServices
{ {
static TaskPool<AsyncUniTask<TStateMachine, T>> pool; static TaskPool<AsyncUniTask<TStateMachine, T>> pool;
TStateMachine stateMachine; IAsyncStateMachine stateMachine; // unfortunatelly boxed to fix IL2CPP issue.
public Action MoveNext { get; } public Action MoveNext { get; }
@ -245,7 +245,8 @@ namespace Cysharp.Threading.Tasks.CompilerServices
runnerPromiseFieldRef = result; // set runner before copied. runnerPromiseFieldRef = result; // set runner before copied.
result.stateMachine = stateMachine; // copy struct StateMachine(in release build). result.stateMachine = stateMachine; // copy struct StateMachine(in release build).
UnityEngine.Debug.Log($"SetStateMachine State:" + StateMachineUtility.GetState(stateMachine));
// UnityEngine.Debug.Log($"SetStateMachine State:" + StateMachineUtility.GetState(stateMachine));
} }
@ -268,7 +269,7 @@ namespace Cysharp.Threading.Tasks.CompilerServices
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
void Run() void Run()
{ {
UnityEngine.Debug.Log($"MoveNext State:" + StateMachineUtility.GetState(stateMachine)); // UnityEngine.Debug.Log($"MoveNext State:" + StateMachineUtility.GetState(stateMachine));
stateMachine.MoveNext(); stateMachine.MoveNext();
} }

View File

@ -19,7 +19,7 @@ namespace Cysharp.Threading.Tasks.Linq
{ {
internal static async UniTask<TSource[]> ToArrayAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken) internal static async UniTask<TSource[]> ToArrayAsync<TSource>(IUniTaskAsyncEnumerable<TSource> source, CancellationToken cancellationToken)
{ {
UnityEngine.Debug.Log("Called ToArray"); // UnityEngine.Debug.Log("Called ToArray");
var pool = ArrayPool<TSource>.Shared; var pool = ArrayPool<TSource>.Shared;
var array = pool.Rent(16); var array = pool.Rent(16);

View File

@ -1,7 +1,7 @@
{ {
"name": "com.cysharp.unitask", "name": "com.cysharp.unitask",
"displayName": "UniTask", "displayName": "UniTask",
"version": "2.0.14", "version": "2.0.15",
"unity": "2018.4", "unity": "2018.4",
"description": "Provides an efficient async/await integration to Unity.", "description": "Provides an efficient async/await integration to Unity.",
"keywords": [ "async/await", "async", "Task", "UniTask" ], "keywords": [ "async/await", "async", "Task", "UniTask" ],

View File

@ -413,6 +413,19 @@ public class SandboxMain : MonoBehaviour
Debug.Log("after"); Debug.Log("after");
} }
private async UniTaskVoid ExecuteAsync()
{
Debug.Log("1");
{
var xs = await UniTaskAsyncEnumerable.TimerFrame(1).ToArrayAsync();
}
Debug.Log("------------------");
{
var xs = await UniTaskAsyncEnumerable.TimerFrame(1).ToArrayAsync();
Debug.Log("2");
}
}
void Start() void Start()
{ {
@ -423,7 +436,7 @@ public class SandboxMain : MonoBehaviour
//StartCoroutine(TestCoroutine().ToCoroutine()); //StartCoroutine(TestCoroutine().ToCoroutine());
Application.logMessageReceived += Application_logMessageReceived; // Application.logMessageReceived += Application_logMessageReceived;
@ -432,13 +445,9 @@ public class SandboxMain : MonoBehaviour
okButton.onClick.AddListener(UniTask.UnityAction(async () => okButton.onClick.AddListener(UniTask.UnityAction(async () =>
{ {
{ _ = ExecuteAsync();
var xs = await UniTaskAsyncEnumerable.TimerFrame(1).ToArrayAsync();
} await UniTask.Yield();
Debug.Log("------------------");
{
var xs = await UniTaskAsyncEnumerable.TimerFrame(1).ToArrayAsync();
}
//await DelayCheck(); //await DelayCheck();
/* /*

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 370f60b2e4cd92d4faafda153c9c5f8a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: