aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/thread.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-05-16 21:33:15 +0200
committerGitHub <[email protected]>2023-05-16 21:33:15 +0200
commit43af8814456f337b3a98a1dbda1c6dbe123293a2 (patch)
treee8d9b7a5343fe2ed8b1af8d0add8a6c62a81b4f9 /src/zencore/thread.cpp
parentimplemented subtree copying (diff)
downloadzen-43af8814456f337b3a98a1dbda1c6dbe123293a2.tar.xz
zen-43af8814456f337b3a98a1dbda1c6dbe123293a2.zip
added benchmark utility command `bench` (#298)
currently this implements a way (`zen bench --purge`) to purge the standby lists on Windows. This basically flushes the file system cache and is useful to put your system in a consistent state before running benchmarks
Diffstat (limited to 'src/zencore/thread.cpp')
-rw-r--r--src/zencore/thread.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/zencore/thread.cpp b/src/zencore/thread.cpp
index fe81cc786..52b1e5d4e 100644
--- a/src/zencore/thread.cpp
+++ b/src/zencore/thread.cpp
@@ -679,6 +679,25 @@ ProcessHandle::Wait(int TimeoutMs)
ThrowLastError("Process::Wait failed"sv);
}
+int
+ProcessHandle::WaitExitCode()
+{
+ Wait(-1);
+
+#if ZEN_PLATFORM_WINDOWS
+ DWORD ExitCode = 0;
+ GetExitCodeProcess(m_ProcessHandle, &ExitCode);
+
+ ZEN_ASSERT(ExitCode != STILL_ACTIVE);
+
+ return ExitCode;
+#else
+ ZEN_NOT_IMPLEMENTED();
+
+ return 0;
+#endif
+}
+
//////////////////////////////////////////////////////////////////////////
#if !ZEN_PLATFORM_WINDOWS || ZEN_WITH_TESTS