| 104 | } |
| 105 | public: |
| 106 | ThreadPool( |
| 107 | std::string name, |
| 108 | supplier<std::shared_ptr<Worker<T, R>>> workersSupplier, |
| 109 | consumer<R&> resultConsumer |
| 110 | ) : logger(std::move(name)), resultConsumer(resultConsumer) { |
| 111 | const uint num_threads = std::thread::hardware_concurrency(); |
| 112 | for (uint i = 0; i < num_threads; i++) { |
| 113 | threads.emplace_back(&ThreadPool<T,R>::threadLoop, this, i, workersSupplier()); |
| 114 | workersBlocked.emplace_back(); |
| 115 | } |
| 116 | } |
| 117 | ~ThreadPool(){ |
| 118 | terminate(); |
| 119 | } |
nothing calls this directly
no outgoing calls
no test coverage detected