问题描述
我已经被难住了好几天,我已经放弃了试图理解它。在网上寻找原因/解决方案,但找不到任何...不知道为什么??!??
使用 g++ 11.1.0 版
我使用的 VS 版本
这是代码。谢谢!!!
#include <iostream>
#include <thread>
#include <vector>
const int PRODUCER_COUNT = 10;
void Producer(int index) {
}
int main() {
std::vector<std::thread> producers_and_consumers;
int i = 0;
// Create producers
for (int i = 0; i < PRODUCER_COUNT; ++i)
producers_and_consumers.push_back(std::thread(Producer,i));
// Wait for consumers and producers to finish
for (auto& t : producers_and_consumers)
t.join();
getchar();
return 0;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)