我在C++中进行多线程处理.我在Windows上.这就是我所拥有的:
int i;
try {
std::vector<std::thread> threads;
for (i = 0; i < threadscount; i++) {
threads.push_back(std::thread(myvoid));
std::cout << "started\n";
}
for (i = 0; i < threadscount; i++) {
threads[i].join();
std::cout << "joined\n";
}
}
catch (...) {}
Run Code Online (Sandbox Code Playgroud)
但是当我设置threadscount为2000个线程时,我得到:
已经调用了abort().
为什么会这样?我能解决这个问题吗?