libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
ThreadPool.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <string>
5#include <thread>
6#include <stdint.h>
8
9#define BS_THREAD_POOL_ENABLE_PRIORITY
10#define BS_THREAD_POOL_ENABLE_PAUSE
11#include <BS_thread_pool.hpp>
12
13namespace Ship {
14
26class ThreadPool : public Component {
27 public:
32 explicit ThreadPool(size_t threadCount);
33 ~ThreadPool() override = default;
34
39 std::shared_ptr<BS::thread_pool> Get() const;
40
42 void Pause();
43
45 void Unpause();
46
47 private:
48 std::shared_ptr<BS::thread_pool> mThreadPool;
49};
50
51} // namespace Ship
A named Part with a parent/child hierarchy and optional thread safety.
Definition Component.h:34
Component wrapper around a BS::thread_pool.
Definition ThreadPool.h:26
void Pause()
Pauses the thread pool, preventing it from picking up new tasks.
~ThreadPool() override=default
std::shared_ptr< BS::thread_pool > Get() const
Returns the underlying thread pool.
ThreadPool(size_t threadCount)
Constructs a ThreadPool with the given number of worker threads.
void Unpause()
Unpauses the thread pool, allowing it to resume picking up tasks.
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14