fixed thr bug that empty job can't finish correctly

This commit is contained in:
2026-04-12 22:33:04 +09:00
parent 2ccc19092c
commit 6f7f70a739

View File

@@ -106,12 +106,14 @@ internal class WorkerThread : IDisposable
if (jobInfo.pExecutionFunc != null) if (jobInfo.pExecutionFunc != null)
{ {
var ctx = new JobExecutionContext(_index, _scheduler); var ctx = new JobExecutionContext(_index, _scheduler);
if (jobInfo.pExecutionFunc(jobInfo.pJobData, ref jobInfo.jobRanges, ref jobInfo.remainingBatches, in ctx)) if (!jobInfo.pExecutionFunc(jobInfo.pJobData, ref jobInfo.jobRanges, ref jobInfo.remainingBatches, in ctx))
{ {
// If the job returns true, it means we are the last worker to process this job. // If the job returns false, it means it we are not the last worker to process this job, so we should not mark it as complete yet.
_scheduler.MarkJobComplete(handle); continue;
} }
} }
_scheduler.MarkJobComplete(handle);
} }
} }
} }