diff options
| -rw-r--r-- | zencore/include/zencore/thread.h | 1 | ||||
| -rw-r--r-- | zencore/thread.cpp | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/zencore/include/zencore/thread.h b/zencore/include/zencore/thread.h index 8a0adbe9f..4b5267a29 100644 --- a/zencore/include/zencore/thread.h +++ b/zencore/include/zencore/thread.h @@ -143,6 +143,7 @@ private: }; ZENCORE_API bool IsProcessRunning(int pid); +ZENCORE_API int GetCurrentProcessId(); ZENCORE_API void Sleep(int ms); 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) { |