mirror of
https://github.com/DCFApixels/DragonECS-ClassicThreads.git
synced 2025-09-17 19:24:37 +08:00
add try catch block in thread
This commit is contained in:
parent
893313990a
commit
10bad36486
@ -15,17 +15,22 @@ namespace DCFApixels.DragonECS
|
||||
private static void ThreadProc(object obj)
|
||||
{
|
||||
ref ThreadReacord record = ref _threads[(int)obj];
|
||||
//try
|
||||
//{
|
||||
while (Thread.CurrentThread.IsAlive)
|
||||
|
||||
while (Thread.CurrentThread.IsAlive)
|
||||
{
|
||||
try
|
||||
{
|
||||
record.runWork.WaitOne();
|
||||
record.runWork.Reset();
|
||||
_worker.Invoke(new ReadOnlySpan<int>(_entities, record.start, record.size));
|
||||
record.doneWork.Set();
|
||||
}
|
||||
//}
|
||||
//catch { }
|
||||
catch (Exception)
|
||||
{
|
||||
record.doneWork.Set();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ThreadRunner()
|
||||
|
Loading…
Reference in New Issue
Block a user