aboutsummaryrefslogtreecommitdiff
path: root/src/zenutil/include
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2023-11-29 09:14:57 -0500
committerGitHub <[email protected]>2023-11-29 15:14:57 +0100
commit68b3382ef7e0f7795b9a601aae73adc2f8ef9873 (patch)
treea8460fa497195575505e14f7beef069ecee31ef7 /src/zenutil/include
parentfixed file logger pattern (#579) (diff)
downloadzen-68b3382ef7e0f7795b9a601aae73adc2f8ef9873.tar.xz
zen-68b3382ef7e0f7795b9a601aae73adc2f8ef9873.zip
global thread worker pools (#577)
- Improvement: Use two global worker thread pools instead of ad-hoc creation of worker pools
Diffstat (limited to 'src/zenutil/include')
-rw-r--r--src/zenutil/include/zenutil/workerpools.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/zenutil/include/zenutil/workerpools.h b/src/zenutil/include/zenutil/workerpools.h
new file mode 100644
index 000000000..339120ece
--- /dev/null
+++ b/src/zenutil/include/zenutil/workerpools.h
@@ -0,0 +1,21 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#pragma once
+
+#include <zencore/workthreadpool.h>
+
+namespace zen {
+
+// Worker pool with std::thread::hardware_concurrency() worker threads
+WorkerThreadPool& GetLargeWorkerPool();
+
+// Worker pool with std::thread::hardware_concurrency() / 4 worker threads
+WorkerThreadPool& GetSmallWorkerPool();
+
+// Special worker pool that does not use worker thread but issues all scheduled work on the calling thread
+// This is useful for debugging when multiple async thread can make stepping in debugger complicated
+WorkerThreadPool& GetSyncWorkerPool();
+
+void ShutdownWorkerPools();
+
+} // namespace zen