ThreadPool() { // We don't need a thread for the current core. unsigned threadCount = numberOfProcessorCores() - 1; m_workers.reserveInitialCapacity(threadCount); for (unsigned i = 0; i < threadCount; ++i) { m_workers.append(Thread::create("ThreadPool Worker", [this] { threadBody(); })); } }
ThreadPool() { // We don't need a thread for the current core. unsigned threadCount = numberOfProcessorCores() - 1; m_workers.reserveInitialCapacity(threadCount); for (unsigned i = 0; i < threadCount; ++i) { m_workers.append(createThread(String::format("ThreadPool Worker %u", i).utf8().data(), [this] { threadBody(); })); } }