diff options
| author | Stefan Boberg <[email protected]> | 2021-08-09 13:44:30 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-08-09 13:44:30 +0200 |
| commit | 5e47d3a9adb549eb001a041a95fac285b256aa99 (patch) | |
| tree | 05ba61cc5c1fba78af697c93253fb9e110a30cd8 /zencore/thread.cpp | |
| parent | Added some new management commands (diff) | |
| download | zen-5e47d3a9adb549eb001a041a95fac285b256aa99.tar.xz zen-5e47d3a9adb549eb001a041a95fac285b256aa99.zip | |
Added IsProcessRunning()/GetCurrentProcessId() helpers
Diffstat (limited to 'zencore/thread.cpp')
| -rw-r--r-- | zencore/thread.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/zencore/thread.cpp b/zencore/thread.cpp index 5cbb6999d..eb16201fd 100644 --- a/zencore/thread.cpp +++ b/zencore/thread.cpp @@ -220,6 +220,27 @@ ProcessHandle::Wait(int TimeoutMs) return false; } +bool +IsProcessRunning(int pid) +{ + HANDLE hProc = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid); + + if (hProc == NULL) + { + return false; + } + + CloseHandle(hProc); + + return true; +} + +int +GetCurrentProcessId() +{ + return ::GetCurrentProcessId(); +} + void Sleep(int ms) { |