MCPcopy Create free account
hub / github.com/MihailRis/voxelcore / ThreadPool

Method ThreadPool

src/util/ThreadPool.hpp:106–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104 }
105public:
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 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected