我正在尝试在利用多线程处理的同时将任意数量的图像加载到向量(imageVector
)中。我写了这个,但是它在文件“内存”中引发了C2661错误,说std::tuple
没有带有4个参数的重载
我认为这与threads.push_back...
有关,因为当我注释掉时,错误会改变
std::mutex safeGuard, threadWait;
std::condition_variable holdThread;
std::vector<std::thread*> threads;
for (std::vector<std::wstring>::iterator it = g_vecImageFileNames.begin(); it != g_vecImageFileNames.end(); it++) {
std::unique_lock<std::mutex> lock(threadWait);
holdThread.wait(lock, [threads](){return threads.size() >= std::thread::hardware_concurrency(); });
threads.push_back(new std::thread(loadImageMutex, *it, imageVector, safeGuard));
threads.back()->join();
}