Question: See the following example:

![](https://i.gyazo.com/37e07c37d3f2b9a15231f2f90a2e3b1d.png)

```
    <div class="row">
      <div class="col-2">
        <p>Error</p>
      </div>
      <div class="col-8">
        <div class="progress error" data-toggle="tooltip" data-placement="bottom">
          <div class="progress-bar error-bar" role="progressbar"></div>
        </div>
      </div>
      <div class="col-2">
        <a tabindex="0" data-container="body" data-toggle="popover" data-placement="right" data-content="Some random text">
          <i class="fa fa-info-circle" aria-hidden="true" style="vertical-align: top"></i>
        </a>
      </div>
    </div>

```

The text "Error" is not vertically aligned properly with the prograss bar and font awesome icon. I tried adding `vertical-align: top` to `<p>` but it did not make a difference. How do I correctly vertically align the text?

Answer: 
Well, Based on the coding logic regardless infinite loop, if you concern about memory corruption, I will said “no I won’t be happen due to assignment point is eventually assigned x1 or x2.

I think you are not clear enough what is not guarantee assignment is atomic, if your program has multiple thread doing assignment to one global variable, it will not guarantee you that each of assignment is successfully assigned to it. 
Based on that, it might have a lot of x1 assignment has lost assigned or the other one.

Back to what is your main purpose of this code, if your are planning to change pointer time to time and multiple read operation. I suggest you only 1 thread to do assignment
No, this is not safe, it is a data race. It is undefined behavior. The point is not so much what happens on the hardware, but what happens inside the compiler. Compilers have become very clever at optimizing code, they try to prove certain properties of the code to be able to transform it to something that runs faster. To do this, they assume the program does not have undefined behavior.

As pointed out in a [comment](https://stackoverflow.com/questions/46407889/is-multithreading-swapping-2-predefined-pointer-to-1-static-pointer-thread-safe#comment79773585_46407925), it would be a valid and useful optimisation to replace

```
while(1) global = x1;

```

by

```
global = x1;

```

because the compiler will assume `global` is not changed by another thread.