educative.io

Why is not Third Execution consistent?

in lesson CppMem: Non-Atomic Variables
why is not Third Execution consistent?

Hi @Luis_Tung
Thanks for reaching out to us. The third execution is not consistent because the value of x is not read from the value in the main thread ( a ) while it read from x using a separate thread (not main-thread) in the expressions ( c ). In the concrete execution, x and y get the value 0.


I hope it helps. Happy Learning :slight_smile:

I got it. thanks for your answer.

1 Like