Compare commits

..

2 Commits

Author SHA1 Message Date
Tommaso Checchi
b999b17b90 Merge 6b1e951b64 into 98538ef7c7 2025-09-13 01:24:24 +09:00
Tommaso Checchi
6b1e951b64 RunOnThreadPool: fixed an issue where a cancellation could prevent returning to the main thread 2025-07-09 21:29:12 -07:00
12 changed files with 77 additions and 97 deletions

View File

@@ -5,10 +5,6 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "weekly" # Check for updates to GitHub Actions every week interval: "weekly" # Check for updates to GitHub Actions every week
groups:
dependencies:
patterns:
- "*"
cooldown: cooldown:
default-days: 14 # Wait 14 days before creating another PR for the same dependency. This will prevent vulnerability on the package impact. default-days: 14 # Wait 14 days before creating another PR for the same dependency. This will prevent vulnerability on the package impact.
ignore: ignore:

View File

@@ -101,7 +101,6 @@ jobs:
needs: [update-packagejson, build-dotnet, build-unity] needs: [update-packagejson, build-dotnet, build-unity]
permissions: permissions:
contents: write contents: write
id-token: write # required for NuGet Trusted Publish
uses: Cysharp/Actions/.github/workflows/create-release.yaml@main uses: Cysharp/Actions/.github/workflows/create-release.yaml@main
with: with:
commit-id: ${{ needs.update-packagejson.outputs.sha }} commit-id: ${{ needs.update-packagejson.outputs.sha }}

14
.gitignore vendored
View File

@@ -100,19 +100,7 @@ publish
*.Publish.xml *.Publish.xml
# NuGet Packages Directory # NuGet Packages Directory
*.nupkg packages
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
# packages # upm pacakge will use Packages
# **/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
# !**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Windows Azure Build Output # Windows Azure Build Output
csx csx

View File

@@ -1,11 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)opensource.snk</AssemblyOriginatorKeyFile>
<!-- NuGet Package Information --> <!-- NuGet Package Information -->
<IsPackable>false</IsPackable>
<PackageVersion>$(Version)</PackageVersion> <PackageVersion>$(Version)</PackageVersion>
<Company>Cysharp</Company> <Company>Cysharp</Company>
<Authors>Cysharp</Authors> <Authors>Cysharp</Authors>
@@ -20,8 +16,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="$(MSBuildThisFileDirectory)Icon.png" Pack="true" PackagePath="\" />
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="\" /> <None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="\" />
<EmbeddedResource Include="$(MSBuildThisFileDirectory)LICENSE" /> <None Include="$(MSBuildThisFileDirectory)Icon.png" Pack="true" PackagePath="\" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -10,9 +10,11 @@
<NoWarn>$(NoWarn);CS1591</NoWarn> <NoWarn>$(NoWarn);CS1591</NoWarn>
<!-- NuGet Packaging --> <!-- NuGet Packaging -->
<IsPackable>true</IsPackable>
<Id>UniTask</Id> <Id>UniTask</Id>
<Description>Provides an efficient async/await integration to Unity and .NET Core.</Description> <Description>Provides an efficient async/await integration to Unity and .NET Core.</Description>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>opensource.snk</AssemblyOriginatorKeyFile>
<IsPackable>true</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@@ -4,6 +4,7 @@
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<RootNamespace>NetCoreSandbox</RootNamespace> <RootNamespace>NetCoreSandbox</RootNamespace>
<IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@@ -15,6 +16,8 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\UniTask.NetCore\UniTask.NetCore.csproj" /> <ProjectReference Include="..\UniTask.NetCore\UniTask.NetCore.csproj" />
<ProjectReference Include="..\UniTask.Analyzer\UniTask.Analyzer.csproj"> <ProjectReference Include="..\UniTask.Analyzer\UniTask.Analyzer.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly> <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
<OutputItemType>Analyzer</OutputItemType> <OutputItemType>Analyzer</OutputItemType>

View File

@@ -2,6 +2,9 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0</TargetFramework> <TargetFramework>net7.0</TargetFramework>
<IsPackable>false</IsPackable>
<RootNamespace>NetCoreTests</RootNamespace> <RootNamespace>NetCoreTests</RootNamespace>
</PropertyGroup> </PropertyGroup>

View File

@@ -10,11 +10,6 @@ using UnityEditor.IMGUI.Controls;
using Cysharp.Threading.Tasks.Internal; using Cysharp.Threading.Tasks.Internal;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
#if UNITY_6000_2_OR_NEWER
using TreeView = UnityEditor.IMGUI.Controls.TreeView<int>;
using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem<int>;
using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState<int>;
#endif
namespace Cysharp.Threading.Tasks.Editor namespace Cysharp.Threading.Tasks.Editor
{ {
@@ -184,3 +179,4 @@ namespace Cysharp.Threading.Tasks.Editor
} }
} }

View File

@@ -66,12 +66,11 @@ namespace Cysharp.Threading.Tasks
await UniTask.SwitchToThreadPool(); await UniTask.SwitchToThreadPool();
cancellationToken.ThrowIfCancellationRequested();
if (configureAwait) if (configureAwait)
{ {
try try
{ {
cancellationToken.ThrowIfCancellationRequested();
action(); action();
} }
finally finally
@@ -81,6 +80,7 @@ namespace Cysharp.Threading.Tasks
} }
else else
{ {
cancellationToken.ThrowIfCancellationRequested();
action(); action();
} }
@@ -94,12 +94,11 @@ namespace Cysharp.Threading.Tasks
await UniTask.SwitchToThreadPool(); await UniTask.SwitchToThreadPool();
cancellationToken.ThrowIfCancellationRequested();
if (configureAwait) if (configureAwait)
{ {
try try
{ {
cancellationToken.ThrowIfCancellationRequested();
action(state); action(state);
} }
finally finally
@@ -109,6 +108,7 @@ namespace Cysharp.Threading.Tasks
} }
else else
{ {
cancellationToken.ThrowIfCancellationRequested();
action(state); action(state);
} }
@@ -122,12 +122,11 @@ namespace Cysharp.Threading.Tasks
await UniTask.SwitchToThreadPool(); await UniTask.SwitchToThreadPool();
cancellationToken.ThrowIfCancellationRequested();
if (configureAwait) if (configureAwait)
{ {
try try
{ {
cancellationToken.ThrowIfCancellationRequested();
await action(); await action();
} }
finally finally
@@ -137,6 +136,7 @@ namespace Cysharp.Threading.Tasks
} }
else else
{ {
cancellationToken.ThrowIfCancellationRequested();
await action(); await action();
} }
@@ -150,12 +150,11 @@ namespace Cysharp.Threading.Tasks
await UniTask.SwitchToThreadPool(); await UniTask.SwitchToThreadPool();
cancellationToken.ThrowIfCancellationRequested();
if (configureAwait) if (configureAwait)
{ {
try try
{ {
cancellationToken.ThrowIfCancellationRequested();
await action(state); await action(state);
} }
finally finally
@@ -165,6 +164,7 @@ namespace Cysharp.Threading.Tasks
} }
else else
{ {
cancellationToken.ThrowIfCancellationRequested();
await action(state); await action(state);
} }
@@ -178,12 +178,11 @@ namespace Cysharp.Threading.Tasks
await UniTask.SwitchToThreadPool(); await UniTask.SwitchToThreadPool();
cancellationToken.ThrowIfCancellationRequested();
if (configureAwait) if (configureAwait)
{ {
try try
{ {
cancellationToken.ThrowIfCancellationRequested();
return func(); return func();
} }
finally finally
@@ -194,6 +193,7 @@ namespace Cysharp.Threading.Tasks
} }
else else
{ {
cancellationToken.ThrowIfCancellationRequested();
return func(); return func();
} }
} }
@@ -205,23 +205,22 @@ namespace Cysharp.Threading.Tasks
await UniTask.SwitchToThreadPool(); await UniTask.SwitchToThreadPool();
cancellationToken.ThrowIfCancellationRequested();
if (configureAwait) if (configureAwait)
{ {
try try
{ {
cancellationToken.ThrowIfCancellationRequested();
return await func(); return await func();
} }
finally finally
{ {
cancellationToken.ThrowIfCancellationRequested();
await UniTask.Yield(); await UniTask.Yield();
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
} }
} }
else else
{ {
cancellationToken.ThrowIfCancellationRequested();
var result = await func(); var result = await func();
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
return result; return result;
@@ -235,12 +234,11 @@ namespace Cysharp.Threading.Tasks
await UniTask.SwitchToThreadPool(); await UniTask.SwitchToThreadPool();
cancellationToken.ThrowIfCancellationRequested();
if (configureAwait) if (configureAwait)
{ {
try try
{ {
cancellationToken.ThrowIfCancellationRequested();
return func(state); return func(state);
} }
finally finally
@@ -251,6 +249,7 @@ namespace Cysharp.Threading.Tasks
} }
else else
{ {
cancellationToken.ThrowIfCancellationRequested();
return func(state); return func(state);
} }
} }
@@ -262,23 +261,22 @@ namespace Cysharp.Threading.Tasks
await UniTask.SwitchToThreadPool(); await UniTask.SwitchToThreadPool();
cancellationToken.ThrowIfCancellationRequested();
if (configureAwait) if (configureAwait)
{ {
try try
{ {
cancellationToken.ThrowIfCancellationRequested();
return await func(state); return await func(state);
} }
finally finally
{ {
cancellationToken.ThrowIfCancellationRequested();
await UniTask.Yield(); await UniTask.Yield();
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
} }
} }
else else
{ {
cancellationToken.ThrowIfCancellationRequested();
var result = await func(state); var result = await func(state);
cancellationToken.ThrowIfCancellationRequested(); cancellationToken.ThrowIfCancellationRequested();
return result; return result;

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.11", "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" ],