一个简单的 C++11 线程池实现
一个简单的 C++11 线程池实现。 基本用法:
// create thread pool with 4 worker threads
ThreadPool pool(4);
// enqueue and store future
auto result = pool.enqueue([](int answer) { return answer; }, 42);
// get result from future
std::cout << result.get() << std::endl;
关于对 [ ThreadPool ] 进行 OpenHarmony 适配的建议
线程池功能扩展
错误
~ThreadPool 期间可能出现死锁
我们如何在线程池中使用 override 成员函数?
意外卡死的线程
a
类似的 C 实现
如何添加对线程绑定 cpu_cores 的支持?
为什么不使用 std::atomic<bool> 而不是 bool?