I'm trying to process data in parallel using std::async but no thread is created nor the code is executed whatsoever for unknown reasons, the code is the following
std::vector<std::future<int>> threads;
for (DWORD offset = 0; offset < 10; offset++) {
threads.push_back(std::async([](std::vector<unsigned int> sig, DWORD address, DWORD size)->int {
// Sleep is never called
Sleep(5);
// Only for test purposes anyway
return 1;
}, signature, 1, 1));
}
for (auto& thread : threads) {
// Hangs here
DWORD result = thread.get();
if (result) {
return (void*)result;
}
}
For the sake of simplicity, i removed most of the useless code and left only the relevant part to the issue.
I tried debugging the code and setting a breakpoint in the Sleep api to check if anything is being executed but nothing happens; also, i can't seem to find any new threads in the process and the code hangs if i call thread.wait()/thread.get().
The code is compiled with visual studio 2019 community with /std:c++17