diff options
Diffstat (limited to 'zencore/thread.cpp')
| -rw-r--r-- | zencore/thread.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/zencore/thread.cpp b/zencore/thread.cpp index 20ab19f56..5aa0f2688 100644 --- a/zencore/thread.cpp +++ b/zencore/thread.cpp @@ -5,6 +5,7 @@ #include <fmt/format.h> #include <zencore/except.h> #include <zencore/string.h> +#include <zencore/testing.h> #if ZEN_PLATFORM_WINDOWS # include <zencore/windows.h> @@ -360,7 +361,9 @@ IsProcessRunning(int pid) return true; #else - ZEN_NOT_IMPLEMENTED(); + char Buffer[64]; + sprintf(Buffer, "/proc/%d", pid); + return access(Buffer, F_OK) == 0; #endif } @@ -389,9 +392,20 @@ Sleep(int ms) // Testing related code follows... // +#if ZEN_WITH_TESTS + void thread_forcelink() { } +TEST_CASE("Thread") +{ + int Pid = GetCurrentProcessId(); + CHECK(Pid > 0); + CHECK(IsProcessRunning(Pid)); +} + +#endif // ZEN_WITH_TESTS + } // namespace zen |