diff options
| author | Stefan Boberg <[email protected]> | 2021-08-06 15:10:01 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-08-06 15:10:01 +0200 |
| commit | e45ee6a2133e3f4c2cb5b3c53341de5e1ce1d20f (patch) | |
| tree | 376dbf5641ee50477aa8ff75e628a13eb8be12c8 | |
| parent | Added GetRunningExecutablePath() (diff) | |
| download | zen-e45ee6a2133e3f4c2cb5b3c53341de5e1ce1d20f.tar.xz zen-e45ee6a2133e3f4c2cb5b3c53341de5e1ce1d20f.zip | |
zen::Process -> zen::ProcessHandle
| -rw-r--r-- | zencore/include/zencore/thread.h | 10 | ||||
| -rw-r--r-- | zencore/thread.cpp | 16 | ||||
| -rw-r--r-- | zenserver/zenserver.cpp | 2 | ||||
| -rw-r--r-- | zentestutil/include/zenserverprocess.h | 2 |
4 files changed, 15 insertions, 15 deletions
diff --git a/zencore/include/zencore/thread.h b/zencore/include/zencore/thread.h index d27d0f189..bf27d75ae 100644 --- a/zencore/include/zencore/thread.h +++ b/zencore/include/zencore/thread.h @@ -119,15 +119,15 @@ private: /** Basic process abstraction */ -class Process +class ProcessHandle { public: - ZENCORE_API Process(); + ZENCORE_API ProcessHandle(); - Process(const Process&) = delete; - Process& operator=(const Process&) = delete; + ProcessHandle(const ProcessHandle&) = delete; + ProcessHandle& operator=(const ProcessHandle&) = delete; - ZENCORE_API ~Process(); + ZENCORE_API ~ProcessHandle(); ZENCORE_API void Initialize(int Pid); ZENCORE_API void Initialize(void* ProcessHandle); /// Initialize with an existing handle - takes ownership of the handle diff --git a/zencore/thread.cpp b/zencore/thread.cpp index 5e558069b..5cbb6999d 100644 --- a/zencore/thread.cpp +++ b/zencore/thread.cpp @@ -139,17 +139,17 @@ NamedMutex::Exists(std::string_view MutexName) return true; } -Process::Process() = default; +ProcessHandle::ProcessHandle() = default; void -Process::Initialize(void* ProcessHandle) +ProcessHandle::Initialize(void* ProcessHandle) { ZEN_ASSERT(m_ProcessHandle == nullptr); // TODO: perform some debug verification here to verify it's a valid handle? m_ProcessHandle = ProcessHandle; } -Process::~Process() +ProcessHandle::~ProcessHandle() { if (IsValid()) { @@ -159,7 +159,7 @@ Process::~Process() } void -Process::Initialize(int Pid) +ProcessHandle::Initialize(int Pid) { ZEN_ASSERT(m_ProcessHandle == nullptr); m_ProcessHandle = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, Pid); @@ -167,7 +167,7 @@ Process::Initialize(int Pid) } bool -Process::IsRunning() const +ProcessHandle::IsRunning() const { DWORD ExitCode = 0; GetExitCodeProcess(m_ProcessHandle, &ExitCode); @@ -176,13 +176,13 @@ Process::IsRunning() const } bool -Process::IsValid() const +ProcessHandle::IsValid() const { return (m_ProcessHandle != nullptr) && (m_ProcessHandle != INVALID_HANDLE_VALUE); } void -Process::Terminate(int ExitCode) +ProcessHandle::Terminate(int ExitCode) { if (IsRunning()) { @@ -198,7 +198,7 @@ Process::Terminate(int ExitCode) } bool -Process::Wait(int TimeoutMs) +ProcessHandle::Wait(int TimeoutMs) { const DWORD Timeout = (TimeoutMs < 0) ? INFINITE : TimeoutMs; diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index 646b6cf5c..307cb75ee 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -240,7 +240,7 @@ private: std::jthread m_IoRunner; asio::io_context m_IoContext; asio::steady_timer m_PidCheckTimer{m_IoContext}; - zen::Process m_Process; + zen::ProcessHandle m_Process; zen::NamedMutex m_ServerMutex; zen::HttpServer m_Http; diff --git a/zentestutil/include/zenserverprocess.h b/zentestutil/include/zenserverprocess.h index 4990230d3..db905b6e7 100644 --- a/zentestutil/include/zenserverprocess.h +++ b/zentestutil/include/zenserverprocess.h @@ -47,7 +47,7 @@ struct ZenServerInstance private: ZenTestEnvironment& m_Env; - zen::Process m_Process; + zen::ProcessHandle m_Process; zen::Event m_ReadyEvent; zen::Event m_ShutdownEvent; bool m_Terminate = false; |