Reputation: 29
So, I'm kinda new to parallel computing...
Let's suppose I have an array arr
in C++ code. Does accessing cells with different indexes from different threads create a race condition? For example if one thread will set some value let's say to arr[i]
and the second one will write into arr[j]
( where i != j
).
Upvotes: 0
Views: 714
Reputation: 5207
If you make sure that all threads use the same array instance and that every thread uses its own index, then there will be no race.
Upvotes: 1