If one thread in a program attempts to read from a variable while another writes to it, the value read is of course undefined. However, assuming there is only one writer, is the write guaranteed to succeed? For example:
bool myGlobalVariable = false;
void thread1() {
    myGlobalVariable = true;
}
void thread2() {
    bool x = myGlobalVariable; //x is undefined
}
In this case, once both threads are finished, is myGlobalVariable guaranteed to be true? 
I'm specifically wondering about gcc on linux, but I'd be interested to know what other operating systems and compilers do, or if ARM behaves differently than x86.