Update package to source only

This commit is contained in:
2026-02-23 16:11:18 +09:00
parent b9adcee57c
commit 9413c1ee0b
10 changed files with 29 additions and 17 deletions

View File

@@ -1,17 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net10.0</TargetFramework> <TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AssemblyVersion>1.3.0</AssemblyVersion> <AssemblyVersion>1.3.1</AssemblyVersion>
<Version>$(AssemblyVersion)</Version> <Version>$(AssemblyVersion)</Version>
<Authors>Misaki</Authors> <Authors>Misaki</Authors>
<PackageProjectUrl>https://git.personalnas.com/Misaki/Misaki.HighPerformance.git</PackageProjectUrl> <PackageProjectUrl>https://git.personalnas.com/Misaki/Misaki.HighPerformance.git</PackageProjectUrl>
<RepositoryUrl>https://git.personalnas.com/Misaki/Misaki.HighPerformance.git</RepositoryUrl> <RepositoryUrl>https://git.personalnas.com/Misaki/Misaki.HighPerformance.git</RepositoryUrl>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>contentFiles</ContentTargetFolders>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -27,4 +28,13 @@
<ProjectReference Include="..\Misaki.HighPerformance\Misaki.HighPerformance.csproj" /> <ProjectReference Include="..\Misaki.HighPerformance\Misaki.HighPerformance.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="contentFiles\cs\any\**\*.cs">
<Pack>true</Pack>
<PackagePath>contentFiles\cs\any\Misaki.HighPerformance.Jobs\</PackagePath>
<PackageCopyToOutput>false</PackageCopyToOutput>
<BuildAction>Compile</BuildAction>
</Content>
</ItemGroup>
</Project> </Project>

View File

@@ -266,6 +266,8 @@ public sealed unsafe partial class JobScheduler : IJobScheduler, IDisposable
private bool _disposed = false; private bool _disposed = false;
internal volatile int _totalJobCount;
internal bool IsCancellationRequested => _cts.IsCancellationRequested; internal bool IsCancellationRequested => _cts.IsCancellationRequested;
public int WorkerCount => _workerThreads.Length; public int WorkerCount => _workerThreads.Length;
@@ -333,6 +335,7 @@ public sealed unsafe partial class JobScheduler : IJobScheduler, IDisposable
jobQueue.Enqueue(handle); jobQueue.Enqueue(handle);
} }
Interlocked.Increment(ref _totalJobCount);
_workSignal.Release(handleCount); _workSignal.Release(handleCount);
} }
} }
@@ -501,7 +504,7 @@ public sealed unsafe partial class JobScheduler : IJobScheduler, IDisposable
if (state == JobState.Completed) if (state == JobState.Completed)
{ {
return; // Already completed (shouldn't happen for single-execution jobs) return;
} }
//if (state != JobState.Running) //if (state != JobState.Running)
@@ -535,11 +538,7 @@ public sealed unsafe partial class JobScheduler : IJobScheduler, IDisposable
} }
// We now have exclusive access to dependentsID (no new readers, old readers finished). // We now have exclusive access to dependentsID (no new readers, old readers finished).
// Safely capture dependents.
var dependentCount = info.dependentCount; var dependentCount = info.dependentCount;
dependentCount = Math.Min(dependentCount, JobInfo.MAX_DEPENDENTS); // Safety cap
// Use stackalloc to avoid allocation, but we'll copy to notify after freeing parent.
var dependentsToNotify = stackalloc JobHandle[dependentCount]; var dependentsToNotify = stackalloc JobHandle[dependentCount];
for (var i = 0; i < dependentCount; i++) for (var i = 0; i < dependentCount; i++)
{ {
@@ -548,6 +547,7 @@ public sealed unsafe partial class JobScheduler : IJobScheduler, IDisposable
_jobDataAllocator.Free(info.pJobData); _jobDataAllocator.Free(info.pJobData);
_jobInfoPool.Remove(handle.ID, handle.Generation); _jobInfoPool.Remove(handle.ID, handle.Generation);
Interlocked.Decrement(ref _totalJobCount);
for (var i = 0; i < dependentCount; i++) for (var i = 0; i < dependentCount; i++)
{ {

View File

@@ -33,6 +33,12 @@ internal class WorkerThread : IDisposable
private bool TryFindJob(out JobHandle handle) private bool TryFindJob(out JobHandle handle)
{ {
if (Interlocked.CompareExchange(ref _scheduler._totalJobCount, 0, 0) == 0)
{
handle = JobHandle.Invalid;
return false;
}
if (_localQueue.TryDequeue(out handle)) if (_localQueue.TryDequeue(out handle))
{ {
return true; return true;
@@ -95,13 +101,10 @@ internal class WorkerThread : IDisposable
} }
ref var jobInfo = ref _scheduler.GetJobInfoReference(handle, out var exist); ref var jobInfo = ref _scheduler.GetJobInfoReference(handle, out var exist);
if (exist) if (exist && Interlocked.CompareExchange(ref jobInfo.state, JobState.Running, JobState.Scheduled) == JobState.Scheduled)
{ {
Interlocked.CompareExchange(ref jobInfo.state, JobState.Running, JobState.Scheduled); if (jobInfo.pExecutionFunc == null
var executeDelegate = jobInfo.pExecutionFunc; || jobInfo.pExecutionFunc(jobInfo.pJobData, ref jobInfo.jobRanges, ref jobInfo.remainingBatches, _index))
if (executeDelegate == null
|| executeDelegate(jobInfo.pJobData, ref jobInfo.jobRanges, ref jobInfo.remainingBatches, _index))
{ {
_scheduler.MarkJobComplete(handle); _scheduler.MarkJobComplete(handle);
} }

View File

@@ -7,12 +7,10 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Misaki</Authors> <Authors>Misaki</Authors>
<AssemblyVersion>1.3.7</AssemblyVersion> <AssemblyVersion>1.3.8</AssemblyVersion>
<Version>$(AssemblyVersion)</Version> <Version>$(AssemblyVersion)</Version>
<PackageProjectUrl>https://git.personalnas.com/Misaki/Misaki.HighPerformance.git</PackageProjectUrl> <PackageProjectUrl>https://git.personalnas.com/Misaki/Misaki.HighPerformance.git</PackageProjectUrl>
<RepositoryUrl>https://git.personalnas.com/Misaki/Misaki.HighPerformance.git</RepositoryUrl> <RepositoryUrl>https://git.personalnas.com/Misaki/Misaki.HighPerformance.git</RepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<IncludeBuildOutput>false</IncludeBuildOutput> <IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>contentFiles</ContentTargetFolders> <ContentTargetFolders>contentFiles</ContentTargetFolders>
</PropertyGroup> </PropertyGroup>
@@ -33,7 +31,8 @@
<ItemGroup> <ItemGroup>
<Content Include="contentFiles\cs\any\**\*.cs"> <Content Include="contentFiles\cs\any\**\*.cs">
<Pack>true</Pack> <Pack>true</Pack>
<PackagePath>contentFiles\cs\any\</PackagePath> <PackagePath>contentFiles\cs\any\Misaki.HighPerformance.LowLevel\</PackagePath>
<PackageCopyToOutput>false</PackageCopyToOutput>
<BuildAction>Compile</BuildAction> <BuildAction>Compile</BuildAction>
</Content> </Content>
</ItemGroup> </ItemGroup>