/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App.Server/AppInstanceMonitor.cs
32 строки
674 B
0x5bfa
Code Quality: Remove Shared dependencies from Controls and Server (#18781)
29 июл 2026, 23:44
Не верифицирован
29 июл 2026, 23:44
7a15d46
Код
Авторство
О чём код?
// Copyright (c) Files Community // Licensed under the MIT License. using System.Diagnostics; namespace Files.App.Server; public sealed class AppInstanceMonitor { private static int processCount = 0; public static void StartMonitor(int processId) { var process = Process.GetProcessById(processId); Interlocked.Increment(ref processCount); process.EnableRaisingEvents = true; process.Exited += Process_Exited; } private static void Process_Exited(object? sender, EventArgs e) { if (sender is Process process) { process.Dispose(); if (Interlocked.Decrement(ref processCount) == 0) { Program.ExitSignal.TrySetResult(true); } } } }