Memory ordering issues
问题 I'm experimenting with C++0x support and there is a problem, that I guess shouldn't be there. Either I don't understand the subject or gcc has a bug. I have the following code, initially x and y are equal. Thread 1 always increments x first and then increments y . Both are atomic integer values, so there is no problem with the increment at all. Thread 2 is checking whether the x is less than y and displays an error message if so. This code fails sometimes, but why? The issue here is probably