From ba16864865dbbb3f69783d210b4f07f599906a73 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Tue, 27 Aug 2024 17:07:11 +0200 Subject: zenserver process launch/termination improvements (#138) * zenserver process launch/termination improvements * fix GetPidStatus to return error code on Linux * fix linux FindProcess() * cleanup IsZombieProcess --- src/zencore/thread.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/zencore/thread.cpp') diff --git a/src/zencore/thread.cpp b/src/zencore/thread.cpp index 329e17eea..394197b8e 100644 --- a/src/zencore/thread.cpp +++ b/src/zencore/thread.cpp @@ -362,16 +362,23 @@ NamedEvent::Close() m_EventHandle = nullptr; } -void +std::error_code NamedEvent::Set() { ZEN_ASSERT(m_EventHandle != nullptr); #if ZEN_PLATFORM_WINDOWS - SetEvent(m_EventHandle); + if (!SetEvent(m_EventHandle)) + { + return MakeErrorCodeFromLastError(); + } #elif ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC int Sem = int(intptr_t(m_EventHandle) >> 32); - semctl(Sem, 0, SETVAL, 0); + if (semctl(Sem, 0, SETVAL, 0) == -1) + { + return MakeErrorCodeFromLastError(); + } #endif + return {}; } bool -- cgit v1.2.3