summaryrefslogtreecommitdiff
path: root/src/thread-pool.hpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2025-01-09 14:44:31 -0500
committerJonathan Bradley <jcb@pikum.xyz>2025-01-09 14:44:31 -0500
commitb76e309166f714b0a66fb4802f02e92a82d09082 (patch)
tree44244fc0e6f873e1ccf6e1e95e2fec62fcec394a /src/thread-pool.hpp
parentb04fefe8ee0086bc1404c06b8351ecb4e942f151 (diff)
flatten file structure + rename
Diffstat (limited to 'src/thread-pool.hpp')
-rw-r--r--src/thread-pool.hpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/thread-pool.hpp b/src/thread-pool.hpp
new file mode 100644
index 0000000..dcb7a13
--- /dev/null
+++ b/src/thread-pool.hpp
@@ -0,0 +1,25 @@
+#ifndef PKE_THREADING_HPP
+#define PKE_THREADING_HPP
+
+#include "dynamic-array.hpp"
+#include "pk.h"
+
+#include <cstdint>
+#include <future>
+
+struct ThreadPoolHandle : public pk_handle { };
+
+constexpr ThreadPoolHandle ThreadPoolHandle_MAX = ThreadPoolHandle{ pk_handle_MAX_constexpr };
+
+void PkeThreads_Init();
+ThreadPoolHandle PkeThreads_Init (uint8_t threadCount, uint8_t maxQueueCount, struct pk_membucket *bkt = nullptr);
+void PkeThreads_Reset (ThreadPoolHandle handle);
+bool PkeThreads_Enqueue (ThreadPoolHandle handle, std::packaged_task<void()> *job);
+int64_t PkeThreads_GetQueueCount (ThreadPoolHandle handle);
+void PkeThreads_Pause (ThreadPoolHandle handle);
+void PkeThreads_Resume (ThreadPoolHandle handle);
+void PkeThreads_Shutdown (ThreadPoolHandle handle);
+void PkeThreads_Teardown ();
+void PkeThreads_Teardown (ThreadPoolHandle handle);
+
+#endif /* PKE_THREADING_HPP */