mirror of
https://git.743378673.xyz/MeloNX/MeloNX.git
synced 2025-07-22 06:37:10 +02:00
Gracefully close the app on exit (#12)
* Gracefully close the app on exit * Application tear down instead of calling Environment.Exit(0); do a better tear down of the application
This commit is contained in:
parent
b73fa8eb22
commit
1df2c5ce7f
6 changed files with 31 additions and 3 deletions
|
@ -4,6 +4,7 @@ using Ryujinx.OsHle.Handles;
|
|||
using Ryujinx.OsHle.Utilities;
|
||||
using System.Collections.Concurrent;
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
namespace Ryujinx.OsHle
|
||||
{
|
||||
|
@ -136,6 +137,18 @@ namespace Ryujinx.OsHle
|
|||
}
|
||||
}
|
||||
|
||||
internal bool ExitProcess(int ProcessId) {
|
||||
Process process;
|
||||
var Success = Processes.TryRemove(ProcessId, out process);
|
||||
if (Success) {
|
||||
process.StopAllThreads();
|
||||
}
|
||||
|
||||
if (Processes.Count == 0) {
|
||||
Ns.OnFinish(EventArgs.Empty);
|
||||
}
|
||||
return Success;
|
||||
}
|
||||
internal bool TryGetProcess(int ProcessId, out Process Process)
|
||||
{
|
||||
if (!Processes.TryGetValue(ProcessId, out Process))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue