v0.12.0.2

This commit is contained in:
Joonas Rikkonen
2021-02-10 17:08:21 +02:00
parent 5c80a59bdd
commit 694cdfee7b
353 changed files with 12897 additions and 5028 deletions
@@ -106,24 +106,7 @@ namespace Barotrauma
{
lock (Coroutines)
{
Coroutines.ForEach(c =>
{
if (c.Name == name)
{
c.AbortRequested = true;
if (c.Thread != null)
{
bool joined = false;
while (!joined)
{
#if CLIENT
CrossThread.ProcessTasks();
#endif
joined = c.Thread.Join(TimeSpan.FromMilliseconds(500));
}
}
}
});
HandleCoroutineStopping(c => c.Name == name);
Coroutines.RemoveAll(c => c.Name == name);
}
}
@@ -132,10 +115,33 @@ namespace Barotrauma
{
lock (Coroutines)
{
HandleCoroutineStopping(c => c == handle);
Coroutines.RemoveAll(c => c == handle);
}
}
private static void HandleCoroutineStopping(Func<CoroutineHandle, bool> filter)
{
foreach (CoroutineHandle coroutine in Coroutines)
{
if (filter(coroutine))
{
coroutine.AbortRequested = true;
if (coroutine.Thread != null)
{
bool joined = false;
while (!joined)
{
#if CLIENT
CrossThread.ProcessTasks();
#endif
joined = coroutine.Thread.Join(TimeSpan.FromMilliseconds(500));
}
}
}
}
}
public static void ExecuteCoroutineThread(CoroutineHandle handle)
{
try