Supposing I have an unsynchronized atomic flag is_finished
. In the following code:
// thread A
while(!is_finished.test(memory_order_relaxed)) {
// supposing I have some observable side effects here
}
// thread B
is_finished.test_and_set(memory_order_relaxed);
If these two threads run concurrently, will thread A always end?