mirror of
https://github.com/DCFApixels/DragonECS-ClassicThreads.git
synced 2025-09-18 03:34:35 +08:00
Update ThreadRunner.cs
This commit is contained in:
parent
696d816797
commit
3c84403389
@ -62,11 +62,20 @@ namespace DCFApixels.DragonECS
|
|||||||
public static void Run(EcsThreadHandler worker, EcsSpan entities, int minSpanSize)
|
public static void Run(EcsThreadHandler worker, EcsSpan entities, int minSpanSize)
|
||||||
{
|
{
|
||||||
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
|
||||||
if (_isRunning) Throw.DoubleParallelIteration();
|
if (_isRunning) { Throw.DoubleParallelIteration(); }
|
||||||
#endif
|
#endif
|
||||||
_isRunning = true;
|
_isRunning = true;
|
||||||
_worker = worker;
|
_worker = worker;
|
||||||
int entitiesCount = entities.Bake(ref _entities);
|
|
||||||
|
if (_entities.Length < entities.Count)
|
||||||
|
{
|
||||||
|
Array.Resize(ref _entities, entities.Count);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < entities.Count; i++)
|
||||||
|
{
|
||||||
|
_entities[i] = entities[i];
|
||||||
|
}
|
||||||
|
int entitiesCount = entities.Count;
|
||||||
|
|
||||||
int threadsCount = entitiesCount / minSpanSize;
|
int threadsCount = entitiesCount / minSpanSize;
|
||||||
if (entitiesCount % minSpanSize > 0)
|
if (entitiesCount % minSpanSize > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user