diff --git a/Misaki.HighPerformance.Jobs/Misaki.HighPerformance.Jobs.csproj b/Misaki.HighPerformance.Jobs/Misaki.HighPerformance.Jobs.csproj index 3e3e220..f1db093 100644 --- a/Misaki.HighPerformance.Jobs/Misaki.HighPerformance.Jobs.csproj +++ b/Misaki.HighPerformance.Jobs/Misaki.HighPerformance.Jobs.csproj @@ -6,7 +6,7 @@ enable True True - 1.5.7 + 1.5.8 $(AssemblyVersion) Misaki https://git.personalnas.com/Misaki/Misaki.HighPerformance.git diff --git a/Misaki.HighPerformance.Jobs/WorkerThread.cs b/Misaki.HighPerformance.Jobs/WorkerThread.cs index 93e3b60..36bda34 100644 --- a/Misaki.HighPerformance.Jobs/WorkerThread.cs +++ b/Misaki.HighPerformance.Jobs/WorkerThread.cs @@ -101,8 +101,14 @@ internal class WorkerThread : IDisposable } ref var jobInfo = ref _scheduler.GetJobInfoReference(handle, out var exist); - if (exist && Interlocked.CompareExchange(ref jobInfo.state, JobState.Running, JobState.Scheduled) == JobState.Scheduled) + if (exist) { + var priorState = Interlocked.CompareExchange(ref jobInfo.state, JobState.Running, JobState.Scheduled); + if (priorState != JobState.Scheduled && priorState != JobState.Running) + { + continue; + } + if (jobInfo.pExecutionFunc != null) { var ctx = new JobExecutionContext(_index, _scheduler);