From c445b149a740995d671db5a026cd8b968d6048f5 Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Tue, 10 Sep 2024 16:57:01 +0800 Subject: [PATCH 1/2] fix thread managment --- src/ThreadRunner.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/ThreadRunner.cs b/src/ThreadRunner.cs index 88883c6..3c787d0 100644 --- a/src/ThreadRunner.cs +++ b/src/ThreadRunner.cs @@ -1,6 +1,7 @@ using DCFApixels.DragonECS.ClassicThreadsInternal; using System; using System.Collections.Concurrent; +using System.Linq; using System.Threading; namespace DCFApixels.DragonECS @@ -66,9 +67,16 @@ namespace DCFApixels.DragonECS public static void Run(EcsThreadHandler worker, EcsSpan entities, int minSpanSize) { + if (_isRunning) + { #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS - if (_isRunning) { Throw.DoubleParallelIteration(); } + if (_threads.Any(o => o.thread == Thread.CurrentThread)) + { + Throw.DoubleParallelIteration(); + } #endif + while (_isRunning) { } + } _isRunning = true; _worker = worker; From 95140dbd371d08fbc6059615e4c866d326f7a4de Mon Sep 17 00:00:00 2001 From: Mikhail <99481254+DCFApixels@users.noreply.github.com> Date: Tue, 10 Sep 2024 16:57:46 +0800 Subject: [PATCH 2/2] up version to 0.2.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d81003b..2971aaa 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "displayName": "DragonECS-ClassicThreads", "description": "Classic C# Multithreading for DragonECS", "unity": "2020.3", - "version": "0.2.4", + "version": "0.2.5", "repository": { "type": "git", "url": "https://github.com/DCFApixels/DragonECS-ClassicThreads.git"