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">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AssemblyVersion>1.3.0</AssemblyVersion>
<AssemblyVersion>1.3.1</AssemblyVersion>
<Version>$(AssemblyVersion)</Version>
<Authors>Misaki</Authors>
<PackageProjectUrl>https://git.personalnas.com/Misaki/Misaki.HighPerformance.git</PackageProjectUrl>
<RepositoryUrl>https://git.personalnas.com/Misaki/Misaki.HighPerformance.git</RepositoryUrl>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>contentFiles</ContentTargetFolders>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@@ -27,4 +28,13 @@
<ProjectReference Include="..\Misaki.HighPerformance\Misaki.HighPerformance.csproj" />
</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>

View File

@@ -266,6 +266,8 @@ public sealed unsafe partial class JobScheduler : IJobScheduler, IDisposable
private bool _disposed = false;
internal volatile int _totalJobCount;
internal bool IsCancellationRequested => _cts.IsCancellationRequested;
public int WorkerCount => _workerThreads.Length;
@@ -333,6 +335,7 @@ public sealed unsafe partial class JobScheduler : IJobScheduler, IDisposable
jobQueue.Enqueue(handle);
}
Interlocked.Increment(ref _totalJobCount);
_workSignal.Release(handleCount);
}
}
@@ -501,7 +504,7 @@ public sealed unsafe partial class JobScheduler : IJobScheduler, IDisposable
if (state == JobState.Completed)
{
return; // Already completed (shouldn't happen for single-execution jobs)
return;
}
//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).
// Safely capture dependents.
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];
for (var i = 0; i < dependentCount; i++)
{
@@ -548,6 +547,7 @@ public sealed unsafe partial class JobScheduler : IJobScheduler, IDisposable
_jobDataAllocator.Free(info.pJobData);
_jobInfoPool.Remove(handle.ID, handle.Generation);
Interlocked.Decrement(ref _totalJobCount);
for (var i = 0; i < dependentCount; i++)
{

View File

@@ -33,6 +33,12 @@ internal class WorkerThread : IDisposable
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))
{
return true;
@@ -95,13 +101,10 @@ internal class WorkerThread : IDisposable
}
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);
var executeDelegate = jobInfo.pExecutionFunc;
if (executeDelegate == null
|| executeDelegate(jobInfo.pJobData, ref jobInfo.jobRanges, ref jobInfo.remainingBatches, _index))
if (jobInfo.pExecutionFunc == null
|| jobInfo.pExecutionFunc(jobInfo.pJobData, ref jobInfo.jobRanges, ref jobInfo.remainingBatches, _index))
{
_scheduler.MarkJobComplete(handle);
}

View File

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