Exemplo n.º 1
0
        private MutualExclusion GetMutex(long MutexAddress)
        {
            MutualExclusion MutexFactory(long Key)
            {
                return(new MutualExclusion(Process, MutexAddress));
            }

            return(Mutexes.GetOrAdd(MutexAddress, MutexFactory));
        }
    private void MutexViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
    {
        MutexViewModel m = (MutexViewModel)sender;

        if (e.PropertyName == "IsChecked" && m.IsChecked)
        {
            foreach (var other in Mutexes.Where(x => x != m))
            {
                other.IsChecked = false;
            }
        }
    }
Exemplo n.º 3
0
        internal void ExitProcess(int ProcessId)
        {
            if (Processes.TryGetValue(ProcessId, out Process Process) && Process.NeedsHbAbi)
            {
                string NextNro = Homebrew.ReadHbAbiNextLoadPath(Process.Memory, Process.HbAbiDataPosition);

                Logging.Info($"HbAbi NextLoadPath {NextNro}");

                if (NextNro == string.Empty)
                {
                    NextNro = "sdmc:/hbmenu.nro";
                }

                NextNro = NextNro.Replace("sdmc:", string.Empty);

                NextNro = Ns.VFs.GetFullPath(Ns.VFs.GetSdCardPath(), NextNro);

                if (File.Exists(NextNro))
                {
                    //TODO: Those dictionaries shouldn't even exist,
                    //the Mutex and CondVar helper classes should be static.
                    Mutexes.Clear();
                    CondVars.Clear();

                    LoadProgram(NextNro);
                }
            }

            if (Processes.TryRemove(ProcessId, out Process))
            {
                Process.StopAllThreadsAsync();
                Process.Dispose();

                if (Processes.Count == 0)
                {
                    Ns.OnFinish(EventArgs.Empty);
                }
            }
        }