summaryrefslogtreecommitdiff
path: root/src/thread_pool.hpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-11-29 20:58:54 -0500
committerJonathan Bradley <jcb@pikum.xyz>2023-11-29 20:58:54 -0500
commit67e40a5d4d3b4e7ed6823e9a768cea48cfd6cfe6 (patch)
tree366aafc44b5c79ef7f8f0898e50f539293c9ffba /src/thread_pool.hpp
parentca78d2bdc7ac42577d14cc199ca082dbe7cd1388 (diff)
add thread_pool
Diffstat (limited to 'src/thread_pool.hpp')
-rw-r--r--src/thread_pool.hpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/thread_pool.hpp b/src/thread_pool.hpp
new file mode 100644
index 0000000..12962dd
--- /dev/null
+++ b/src/thread_pool.hpp
@@ -0,0 +1,22 @@
+#ifndef PKE_THREADING_HPP
+#define PKE_THREADING_HPP
+
+#include "dynamic-array.hpp"
+#include "macros.hpp"
+
+#include <atomic>
+#include <condition_variable>
+#include <cstdint>
+#include <future>
+
+TypeSafeInt_H(ThreadPoolHandle, uint64_t, 0xFFFFFFFFFFFFFFFF);
+
+ThreadPoolHandle PkeThreads_Init (uint8_t threadCount, uint8_t maxQueueCount, MemBucket *bkt = nullptr);
+void PkeThreads_Reset (ThreadPoolHandle handle);
+bool PkeThreads_Enqueue (ThreadPoolHandle handle, std::packaged_task<void()> job);
+void PkeThreads_Pause (ThreadPoolHandle handle);
+void PkeThreads_Resume (ThreadPoolHandle handle);
+void PkeThreads_Shutdown (ThreadPoolHandle handle);
+void PkeThreads_Teardown (ThreadPoolHandle handle);
+
+#endif /* PKE_THREADING_HPP */