mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-11 03:26:39 +00:00
Terminate application before services (#1812)
* Terminate application before services * Use flags instead of title ID
This commit is contained in:
parent
e901b7850c
commit
f5d64b4d68
1 changed files with 13 additions and 3 deletions
|
@ -32,6 +32,7 @@ using Ryujinx.HLE.Loaders.Executables;
|
||||||
using Ryujinx.HLE.Utilities;
|
using Ryujinx.HLE.Utilities;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace Ryujinx.HLE.HOS
|
namespace Ryujinx.HLE.HOS
|
||||||
|
@ -318,8 +319,6 @@ namespace Ryujinx.HLE.HOS
|
||||||
|
|
||||||
_isDisposed = true;
|
_isDisposed = true;
|
||||||
|
|
||||||
SurfaceFlinger.Dispose();
|
|
||||||
|
|
||||||
KProcess terminationProcess = new KProcess(KernelContext);
|
KProcess terminationProcess = new KProcess(KernelContext);
|
||||||
KThread terminationThread = new KThread(KernelContext);
|
KThread terminationThread = new KThread(KernelContext);
|
||||||
|
|
||||||
|
@ -328,7 +327,18 @@ namespace Ryujinx.HLE.HOS
|
||||||
// Force all threads to exit.
|
// Force all threads to exit.
|
||||||
lock (KernelContext.Processes)
|
lock (KernelContext.Processes)
|
||||||
{
|
{
|
||||||
foreach (KProcess process in KernelContext.Processes.Values)
|
// Terminate application.
|
||||||
|
foreach (KProcess process in KernelContext.Processes.Values.Where(x => x.Flags.HasFlag(ProcessCreationFlags.IsApplication)))
|
||||||
|
{
|
||||||
|
process.Terminate();
|
||||||
|
}
|
||||||
|
|
||||||
|
// The application existed, now surface flinger can exit too.
|
||||||
|
SurfaceFlinger.Dispose();
|
||||||
|
|
||||||
|
// Terminate HLE services (must be done after the application is already terminated,
|
||||||
|
// otherwise the application will receive errors due to service termination.
|
||||||
|
foreach (KProcess process in KernelContext.Processes.Values.Where(x => !x.Flags.HasFlag(ProcessCreationFlags.IsApplication)))
|
||||||
{
|
{
|
||||||
process.Terminate();
|
process.Terminate();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue