3 ms·
> There are times when you know you are safe because there is a future write that is memory barrier protected so even though there is a potential race, before t
by saagarjha 7y ago
> There are times when you know you are safe because there is a future write that is memory barrier protected so even though there is a potential race, before the other threads can read it this thread will write something else.
Often it is difficult to prove this to the compiler.
- bluGill 7y agoI don't need to prove it to the compiler. I can prove it by a higher level understanding of my own system. So long as the compiler emits the memory barrier when I need it to, and the other thread stays in the state where it won't be reading the memory in question it doesn't matter what the compiler knows.