mirror of
https://github.com/DCFApixels/DragonECS-ClassicThreads.git
synced 2025-09-19 04:24:34 +08:00
Merge branch 'dev'
This commit is contained in:
commit
68b5abc9ee
@ -8,7 +8,7 @@
|
|||||||
"displayName": "DragonECS-ClassicThreads",
|
"displayName": "DragonECS-ClassicThreads",
|
||||||
"description": "Classic C# Multithreading for DragonECS",
|
"description": "Classic C# Multithreading for DragonECS",
|
||||||
"unity": "2020.3",
|
"unity": "2020.3",
|
||||||
"version": "0.2.4",
|
"version": "0.2.5",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/DCFApixels/DragonECS-ClassicThreads.git"
|
"url": "https://github.com/DCFApixels/DragonECS-ClassicThreads.git"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using DCFApixels.DragonECS.ClassicThreadsInternal;
|
using DCFApixels.DragonECS.ClassicThreadsInternal;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace DCFApixels.DragonECS
|
namespace DCFApixels.DragonECS
|
||||||
@ -66,9 +67,16 @@ namespace DCFApixels.DragonECS
|
|||||||
|
|
||||||
public static void Run(EcsThreadHandler worker, EcsSpan entities, int minSpanSize)
|
public static void Run(EcsThreadHandler worker, EcsSpan entities, int minSpanSize)
|
||||||
{
|
{
|
||||||
|
if (_isRunning)
|
||||||
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_isRunning) { Throw.DoubleParallelIteration(); }
|
if (_threads.Any(o => o.thread == Thread.CurrentThread))
|
||||||
|
{
|
||||||
|
Throw.DoubleParallelIteration();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
while (_isRunning) { }
|
||||||
|
}
|
||||||
_isRunning = true;
|
_isRunning = true;
|
||||||
_worker = worker;
|
_worker = worker;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user