Just curious. Subj. How C++ compiler knows not to reorder lock_guard in the beginning of the block? How C++ standard regulates it? Thanks.
{
lock_guard<mutex> g(m); // why this is not reordered to after "a = b"?
a = b;
}
Just curious. Subj. How C++ compiler knows not to reorder lock_guard in the beginning of the block? How C++ standard regulates it? Thanks.
{
lock_guard<mutex> g(m); // why this is not reordered to after "a = b"?
a = b;
}