summaryrefslogtreecommitdiff
path: root/src/thread_pool.hpp
blob: 4eb2fc888040fdff739b8c98aaac9a85747f4c2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef PKE_THREADING_HPP
#define PKE_THREADING_HPP

#include "dynamic-array.hpp"
#include "macros.hpp"

#include <cstdint>
#include <future>

struct ThreadPoolHandle : public PkeHandle { };

constexpr ThreadPoolHandle ThreadPoolHandle_MAX = ThreadPoolHandle{};

void PkeThreads_Init();
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);
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 */