示例#1
0
        private void Unload()
        {
            if (Disposed || Threads.Count > 0)
            {
                return;
            }

            Disposed = true;

            foreach (object Obj in HandleTable.Clear())
            {
                if (Obj is KSession Session)
                {
                    Session.Dispose();
                }
            }

            INvDrvServices.UnloadProcess(this);

            if (NeedsHbAbi && Executables.Count > 0 && Executables[0].FilePath.EndsWith(Homebrew.TemporaryNroSuffix))
            {
                File.Delete(Executables[0].FilePath);
            }

            Device.Log.PrintInfo(LogClass.Loader, $"Process {ProcessId} exiting...");
        }
示例#2
0
文件: Process.cs 项目: ckarcz/Ryujinx
        protected virtual void Dispose(bool Disposing)
        {
            if (Disposing && !Disposed)
            {
                //If there is still some thread running, disposing the objects is not
                //safe as the thread may try to access those resources. Instead, we set
                //the flag to have the Process disposed when all threads finishes.
                //Note: This may not happen if the guest code gets stuck on a infinite loop.
                if (TlsSlots.Count > 0)
                {
                    ShouldDispose = true;

                    Logging.Info($"Process {ProcessId} waiting all threads terminate...");

                    return;
                }

                Disposed = true;

                foreach (object Obj in HandleTable.Clear())
                {
                    if (Obj is KSession Session)
                    {
                        Session.Dispose();
                    }
                }

                ServiceNvDrv.Fds.DeleteProcess(this);

                ServiceNvDrv.NvMaps.DeleteProcess(this);
                ServiceNvDrv.NvMapsById.DeleteProcess(this);
                ServiceNvDrv.NvMapsFb.DeleteProcess(this);

                Scheduler.Dispose();

                AppletState.Dispose();

                SvcHandler.Dispose();

                Memory.Dispose();

                Logging.Info($"Process {ProcessId} exiting...");
            }
        }
示例#3
0
        protected virtual void Dispose(bool Disposing)
        {
            if (Disposing && !Disposed)
            {
                if (NeedsHbAbi && Executables[0].FilePath.EndsWith(Homebrew.TemporaryNroSuffix))
                {
                    File.Delete(Executables[0].FilePath);
                }

                //If there is still some thread running, disposing the objects is not
                //safe as the thread may try to access those resources. Instead, we set
                //the flag to have the Process disposed when all threads finishes.
                //Note: This may not happen if the guest code gets stuck on a infinite loop.
                if (TlsSlots.Count > 0)
                {
                    ShouldDispose = true;

                    Ns.Log.PrintInfo(LogClass.Loader, $"Process {ProcessId} waiting all threads terminate...");

                    return;
                }

                Disposed = true;

                foreach (object Obj in HandleTable.Clear())
                {
                    if (Obj is KSession Session)
                    {
                        Session.Dispose();
                    }
                }

                INvDrvServices.UnloadProcess(this);

                AppletState.Dispose();

                SvcHandler.Dispose();

                Memory.Dispose();

                Ns.Log.PrintInfo(LogClass.Loader, $"Process {ProcessId} exiting...");
            }
        }
示例#4
0
 public static void Clear()
 {
     _handles_in.Clear();
     _handles_out.Clear();
 }
示例#5
0
 public void ClearOpenHandles()
 {
     HandleTable.Clear();
 }