/
redgpu
/
ezEngine
Обзор
Документация
Войти
/
redgpu
/
ezEngine
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
Code/Engine/Foundation/System/ProcessGroup.h
49 строк
2 KB
Jan Krassnigg
Migrate code to use Make* functions (#1022)
03 авг 2023, 08:07
Не верифицирован
03 авг 2023, 08:07
c42cf1d
Код
Авторство
О чём код?
#pragma once #if EZ_ENABLED(EZ_SUPPORTS_PROCESSES) # include <Foundation/System/Process.h> /// \brief Process groups are used to tie multiple processes together and ensure they get terminated either on demand or when the /// application crashes /// /// On Windows when an ezProcessGroup instance is destroyed (either normally or due to a crash), all processes that have /// been added to the group will be terminated by the OS. Other operating systems do not provide the terminate on crash guarantee. /// /// Only processes that were launched asynchronously and in a suspended state can be added to process groups. /// They will be resumed by the group. class EZ_FOUNDATION_DLL ezProcessGroup { EZ_DISALLOW_COPY_AND_ASSIGN(ezProcessGroup); public: /// \brief Creates a process group. The name is only used for debugging purposes. ezProcessGroup(ezStringView sGroupName = {}); ~ezProcessGroup(); /// \brief Launches a new process in the group. ezResult Launch(const ezProcessOptions& opt); /// \brief Waits for all the processes in the group to terminate. /// /// Returns EZ_SUCCESS only if all processes have shut down. /// In all other cases, e.g. if the optional timeout is reached, /// EZ_FAILURE is returned. ezResult WaitToFinish(ezTime timeout = ezTime::MakeZero()); /// \brief Tries to kill all processes associated with this group. /// /// Sends a kill command to all processes and then waits indefinitely for them to terminate. /// Note: iForcedExitCode is only supported on Windows. ezResult TerminateAll(ezInt32 iForcedExitCode = -2); /// \brief Returns the container holding all processes of this group. /// /// This can be used to query per-process information such as exit codes. const ezHybridArray<ezProcess, 8>& GetProcesses() const; private: ezUniquePtr<struct ezProcessGroupImpl> m_pImpl; ezHybridArray<ezProcess, 8> m_Processes; }; #endif