Add requested stop all method

https://github.com/Cysharp/UniTask/issues/386
Original fix by fsener in the initial comment of the issue
pull/451/head
adrian-bio 2023-03-21 13:12:46 +01:00 committed by GitHub
parent 73d86259ce
commit f760a2ae78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 0 deletions

View File

@ -509,6 +509,25 @@ namespace Cysharp.Threading.Tasks
}
q.Enqueue(continuation);
}
public static void StopAll()
{
IsEditorApplicationQuitting = true;
if (runners != null) {
for (var i = 0; i < runners.Length; i++) {
runners[i].Clear();
}
}
if (yielders != null) {
for (var i = 0; i < yielders.Length; i++) {
yielders[i].Clear();
}
}
IsEditorApplicationQuitting = false;
}
// Diagnostics helper