Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在考试中有一个问题,但我不明白他们想从我这里得到什么。
这是有一些错误的代码行,但我没有得到它。
int a = 0; #pragma omp parallel for num_threads(4) for (int i = 0; i < 100000; i++) { a++;}
实际上,我正在考虑一个,至于我必须在线程内部。
希望你能帮忙。
问题是a++操作不是原子的。我想你应该已经通过你的课程学习了这个术语,或者你可以在wikipedia上查找定义。
a++