From 4801a7a40b650d0a28273b443e17a99e94a2795c Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Sun, 11 Jun 2023 23:56:35 +0800 Subject: [PATCH] fix --- src/ThreadRunner.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ThreadRunner.cs b/src/ThreadRunner.cs index 415bd12..f2860f3 100644 --- a/src/ThreadRunner.cs +++ b/src/ThreadRunner.cs @@ -21,7 +21,6 @@ namespace DCFApixels.DragonECS record.runWork.WaitOne(); record.runWork.Reset(); _worker.Invoke(new ReadOnlySpan(_entities, record.start, record.size)); - record.doneWork.Set(); } } @@ -66,7 +65,7 @@ namespace DCFApixels.DragonECS thread.start = i * spanSize; thread.size = spanSize; } - _threads[^1].size = entities.Count % (threadsCount - 1); + _threads[threadsCount - 1].size = entities.Count % (threadsCount - 1); } else { @@ -79,7 +78,7 @@ namespace DCFApixels.DragonECS for (int i = 0; i < threadsCount; i++) { ref var thread = ref _threads[i]; - thread.runWork.Reset(); + thread.doneWork.Reset(); thread.runWork.Set(); } for (int i = 0; i < threadsCount; i++)