diff options
Diffstat (limited to 'zencore/thread.cpp')
| -rw-r--r-- | zencore/thread.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/zencore/thread.cpp b/zencore/thread.cpp index f01cba7a8..c710930a6 100644 --- a/zencore/thread.cpp +++ b/zencore/thread.cpp @@ -650,9 +650,7 @@ ProcessHandle::IsRunning() const GetExitCodeProcess(m_ProcessHandle, &ExitCode); bActive = (ExitCode == STILL_ACTIVE); #elif ZEN_PLATFORM_LINUX - StringBuilder<64> ProcPath; - ProcPath << "/proc/" << m_Pid; - bActive = (access(ProcPath.c_str(), F_OK) != 0); + bActive = (kill(pid_t(m_Pid), 0) == 0); #else # error Check process control on this platform #endif @@ -1130,13 +1128,8 @@ IsProcessRunning(int pid) CloseHandle(hProc); return true; -#elif ZEN_PLATFORM_LINUX - char Buffer[64]; - sprintf(Buffer, "/proc/%d", pid); - return access(Buffer, F_OK) == 0; -#elif ZEN_PLATFORM_MAC - kill(pid_t(pid), 0); - return errno != ESRCH; +#elif ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC + return (kill(pid_t(pid), 0) == 0); #endif } |