From 9782fa9cb77e9ee3cdfdfce23d847d611b2718f5 Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Mon, 12 Jun 2023 00:59:01 +0800 Subject: [PATCH] update --- src/ThreadRunner.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ThreadRunner.cs b/src/ThreadRunner.cs index f2860f3..5ef288b 100644 --- a/src/ThreadRunner.cs +++ b/src/ThreadRunner.cs @@ -9,13 +9,14 @@ namespace DCFApixels.DragonECS private static ThreadReacord[] _threads; private static ThreadWorkerHandler _worker; + private static ThreadWorkerHandler _nullWorker = delegate { }; private static int[] _entities = new int[64]; private static void ThreadProc(object obj) { ref ThreadReacord record = ref _threads[(int)obj]; - try - { + //try + //{ while (Thread.CurrentThread.IsAlive) { record.runWork.WaitOne(); @@ -23,8 +24,8 @@ namespace DCFApixels.DragonECS _worker.Invoke(new ReadOnlySpan(_entities, record.start, record.size)); record.doneWork.Set(); } - } - catch { } + //} + //catch { } } static ThreadRunner() @@ -42,7 +43,7 @@ namespace DCFApixels.DragonECS }; _threads[i].thread.Start(i); } - _worker = delegate { }; + _worker = _nullWorker; } public static void Run(ThreadWorkerHandler worker, EcsReadonlyGroup entities, int minSpanSize) @@ -86,7 +87,7 @@ namespace DCFApixels.DragonECS _threads[i].doneWork.WaitOne(); } - _worker = null; + _worker = _nullWorker; } private struct ThreadReacord