Compare commits

...

3 Commits

Author SHA1 Message Date
github-actions[bot]
7c0f199fe0 feat: Update package.json to 2.5.10 2024-10-03 00:42:37 +00:00
neuecc
9a3ec31533 Merge remote-tracking branch 'origin/master' 2024-10-03 09:41:47 +09:00
neuecc
37d8f4f48e C# 8 #624 2024-10-03 09:41:30 +09:00
3 changed files with 21 additions and 19 deletions

View File

@@ -39,7 +39,7 @@ namespace Cysharp.Threading.Tasks
public WhenEachResult(Exception exception) public WhenEachResult(Exception exception)
{ {
if (exception == null) throw new ArgumentNullException(nameof(exception)); if (exception == null) throw new ArgumentNullException(nameof(exception));
this.Result = default!; this.Result = default;
this.Exception = exception; this.Exception = exception;
} }
@@ -144,24 +144,24 @@ namespace Cysharp.Threading.Tasks
{ {
RunWhenEachTask(self, array[i], length).Forget(); RunWhenEachTask(self, array[i], length).Forget();
} }
}
static async UniTaskVoid RunWhenEachTask(Enumerator self, UniTask<T> task, int length) static async UniTaskVoid RunWhenEachTask(Enumerator self, UniTask<T> task, int length)
{
try
{ {
try var result = await task;
{ self.channel.Writer.TryWrite(new WhenEachResult<T>(result));
var result = await task; }
self.channel.Writer.TryWrite(new WhenEachResult<T>(result)); catch (Exception ex)
} {
catch (Exception ex) self.channel.Writer.TryWrite(new WhenEachResult<T>(ex));
{ }
self.channel.Writer.TryWrite(new WhenEachResult<T>(ex));
}
if (Interlocked.Increment(ref self.completeCount) == length) if (Interlocked.Increment(ref self.completeCount) == length)
{ {
self.state = WhenEachState.Completed; self.state = WhenEachState.Completed;
self.channel.Writer.TryComplete(); self.channel.Writer.TryComplete();
}
} }
} }

View File

@@ -2,7 +2,7 @@
"name": "com.cysharp.unitask", "name": "com.cysharp.unitask",
"displayName": "UniTask", "displayName": "UniTask",
"author": { "name": "Cysharp, Inc.", "url": "https://cysharp.co.jp/en/" }, "author": { "name": "Cysharp, Inc.", "url": "https://cysharp.co.jp/en/" },
"version": "2.5.9", "version": "2.5.10",
"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

@@ -18,6 +18,7 @@ using UnityEngine.SceneManagement;
using UnityEngine.Rendering; using UnityEngine.Rendering;
using System.IO; using System.IO;
using System.Linq.Expressions; using System.Linq.Expressions;
using UnityEngine.Events;
@@ -172,13 +173,14 @@ public class SandboxMain : MonoBehaviour
// var foo = InstantiateAsync<SandboxMain>(this).ToUniTask(); // var foo = InstantiateAsync<SandboxMain>(this).ToUniTask();
// var tako = await foo; // var tako = await foo;
//UnityAction action;
return 10; return 10;
} }