update exceptions

This commit is contained in:
Mikhail 2023-06-26 01:58:18 +08:00
parent 19108fbb41
commit e0ec9c310f
3 changed files with 26 additions and 3 deletions

12
src/Exceptions.cs Normal file
View File

@ -0,0 +1,12 @@
using System;
namespace DCFApixels.DragonECS
{
public static class EcsThrowHalper_ClassicThreads
{
internal static void DoubleParallelIteration(this EcsThrowHalper _)
{
throw new InvalidOperationException("It is forbidden to start a parallel iteration before the last one is finished.");
}
}
}

11
src/Exceptions.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dc7a8620fe24fe14f892ee3f82918c94
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using static DCFApixels.DragonECS.EcsThrowHalper;
namespace DCFApixels.DragonECS namespace DCFApixels.DragonECS
{ {
@ -61,8 +62,7 @@ namespace DCFApixels.DragonECS
public static void Run(EcsThreadHandler worker, EcsReadonlyGroup entities, int minSpanSize) public static void Run(EcsThreadHandler worker, EcsReadonlyGroup entities, int minSpanSize)
{ {
#if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS #if (DEBUG && !DISABLE_DEBUG) || ENABLE_DRAGONECS_ASSERT_CHEKS
if (_isRunning) if (_isRunning) Throw.DoubleParallelIteration();
throw new InvalidOperationException("It is forbidden to start a parallel iteration before the last one is finished.");
#endif #endif
_isRunning = true; _isRunning = true;
_worker = worker; _worker = worker;
@ -116,7 +116,7 @@ namespace DCFApixels.DragonECS
{ {
var exceptions = _catchedExceptions; var exceptions = _catchedExceptions;
_catchedExceptions = null; _catchedExceptions = null;
throw new AggregateException("Mutiplie exceptions", exceptions); throw new AggregateException(exceptions);
} }
} }