Log and flush inside KProcess::Kill

We want to know when the `KProcess` is being killed and flushing log during it is important since it can often result in hangs due to joining not working correctly.
This commit is contained in:
PixelyIon 2022-10-22 17:17:04 +05:30
parent 597a6ff31d
commit c874907eb5

View File

@ -26,6 +26,9 @@ namespace skyline::kernel::type {
} }
void KProcess::Kill(bool join, bool all, bool disableCreation) { void KProcess::Kill(bool join, bool all, bool disableCreation) {
Logger::Warn("Killing {}{}KProcess{}", join ? "and joining " : "", all ? "all threads in " : "HOS-0 in ", disableCreation ? " with new thread creation disabled" : "");
Logger::EmulationContext.Flush();
bool expected{false}; bool expected{false};
if (!join && !alreadyKilled.compare_exchange_strong(expected, true)) if (!join && !alreadyKilled.compare_exchange_strong(expected, true))
// If the process has already been killed and we don't want to wait for it to join then just instantly return rather than waiting on the mutex // If the process has already been killed and we don't want to wait for it to join then just instantly return rather than waiting on the mutex