You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks to me like you're triggering a race condition here:
foo.sum += num*(num-1)
Incrementing an integer isn't atomic unless using interlocked CPU instructions (which I don't think V exposes yet though it does have a reserved atomic keyword which I can only assume will be used for this).
Try changing op as follows and see if you can reproduce it still:
It looks to me like you're triggering a race condition here:
foo.sum += num*(num-1)
Incrementing an integer isn't atomic unless using interlocked CPU instructions (which I don't think V exposes yet though it does have a reserved atomic keyword which I can only assume will be used for this).
Try changing op as follows and see if you can reproduce it still:
Thanks for your advice.
By adding lock in op() , the consistency problem seems to be solved in my machine.
But when I set the loop times ii to a larger number (>100000 for instance), the codes just pause when running, I wonder if a deadlock occurs? By the way, using the sync.channel has the same problem in loop test.
V version: V 0.1.29 b14f779, commited at 2020-11-05 22:59:11 +0200
OS: Ubuntu 20.04
What did you do?
What did you expect to see?
results printed in each loop should be equal.
What did you see instead?
results are not consistent.
The text was updated successfully, but these errors were encountered: