v0.12.0.2
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user