Update Job

This commit is contained in:
2026-02-21 17:20:51 +09:00
parent 4f964b2d2a
commit 7367826978
23 changed files with 511 additions and 276 deletions

View File

@@ -25,7 +25,7 @@ internal static unsafe class JobExecutor
return true;
}
public static bool ExecuteParallel<T>(void* pJobData, ref JobRanges jobRanges, ref int remainingBatches, int threadIndex)
public static bool ExecuteParallelFor<T>(void* pJobData, ref JobRanges jobRanges, ref int remainingBatches, int threadIndex)
where T : unmanaged, IJobParallelFor
{
var pJob = (T*)pJobData;
@@ -51,4 +51,27 @@ internal static unsafe class JobExecutor
return wasTheLastBatch;
}
public static bool ExecuteParallel<T>(void* pJobData, ref JobRanges jobRanges, ref int remainingBatches, int threadIndex)
where T : unmanaged, IJobParallel
{
var pJob = (T*)pJobData;
var wasTheLastBatch = false;
while (true)
{
if (!GetWorkerStealingRange(ref jobRanges, out var start, out var end))
{
break;
}
pJob->Execute(start, end, threadIndex);
if (Interlocked.Decrement(ref remainingBatches) == 0)
{
wasTheLastBatch = true;
}
}
return wasTheLastBatch;
}
}