diff options
| author | Dan Engelbrecht <[email protected]> | 2022-03-22 13:50:08 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-03-22 13:50:08 +0100 |
| commit | 8667509907b8829b5148ee856dce675001051b01 (patch) | |
| tree | 0252caa7cd01c533809b1b17dfa41721a0cccb82 /zenhttp/workthreadpool.h | |
| parent | Remove unused TotalAttachmentsSize (Mac warning) (diff) | |
| download | zen-8667509907b8829b5148ee856dce675001051b01.tar.xz zen-8667509907b8829b5148ee856dce675001051b01.zip | |
move workthreadpool to zencore (#63)
Diffstat (limited to 'zenhttp/workthreadpool.h')
| -rw-r--r-- | zenhttp/workthreadpool.h | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/zenhttp/workthreadpool.h b/zenhttp/workthreadpool.h deleted file mode 100644 index 834339d50..000000000 --- a/zenhttp/workthreadpool.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright Epic Games, Inc. All Rights Reserved. - -#pragma once - -#include <zencore/zencore.h> - -#include <zencore/blockingqueue.h> -#include <zencore/refcount.h> - -#include <exception> -#include <functional> -#include <system_error> -#include <thread> -#include <vector> - -namespace zen { - -struct IWork : public RefCounted -{ - virtual void Execute() = 0; - - inline std::exception_ptr GetException() { return m_Exception; } - -private: - std::exception_ptr m_Exception; - - friend class WorkerThreadPool; -}; - -class WorkerThreadPool -{ -public: - WorkerThreadPool(int InThreadCount); - ~WorkerThreadPool(); - - void ScheduleWork(Ref<IWork> Work); - void ScheduleWork(std::function<void()>&& Work); - - void WorkerThreadFunction(); - -private: - std::vector<std::thread> m_WorkerThreads; - BlockingQueue<Ref<IWork>> m_WorkQueue; -}; - -} // namespace zen |