fixes for support Unity 2020.1.x

This commit is contained in:
Mikhail 2024-01-04 22:52:12 +08:00
parent 908b6328cd
commit db29061ccb

View File

@ -18,6 +18,8 @@ namespace DCFApixels.DragonECS
private static bool _isRunning = false; private static bool _isRunning = false;
private static object _lock = new object();
private static void ThreadProc(object obj) private static void ThreadProc(object obj)
{ {
int i = (int)obj; int i = (int)obj;
@ -116,12 +118,15 @@ namespace DCFApixels.DragonECS
_isRunning = false; _isRunning = false;
_worker = _nullWorker; _worker = _nullWorker;
if (_catchedExceptions.Count > 0) if (_catchedExceptions.Count > 0)
{
lock (_lock)
{ {
Exception[] exceptions = _catchedExceptions.ToArray(); Exception[] exceptions = _catchedExceptions.ToArray();
_catchedExceptions.Clear(); _catchedExceptions = new ConcurrentQueue<Exception>();
throw new AggregateException(exceptions); throw new AggregateException(exceptions);
} }
} }
}
private struct ThreadReacord private struct ThreadReacord
{ {