From 68b3382ef7e0f7795b9a601aae73adc2f8ef9873 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Wed, 29 Nov 2023 09:14:57 -0500 Subject: global thread worker pools (#577) - Improvement: Use two global worker thread pools instead of ad-hoc creation of worker pools --- src/zenutil/include/zenutil/workerpools.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/zenutil/include/zenutil/workerpools.h (limited to 'src/zenutil/include') 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 + +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 -- cgit v1.2.3