4 ms·
I have always wondered about that. If optimizing repeated atomic loads is indeed allowed, waiting for a signal by spinning on an atomic load could loop forever
by binarycoffee 3y ago
I have always wondered about that.
If optimizing repeated atomic loads is indeed allowed, waiting for a signal by spinning on an atomic load could loop forever. Yet I have the feeling most people consider such code to be valid. Are they wrong?
- manwe150 3y agoAcquire loads (and stronger) are required not to loop forever, if they could be observable from another thread. It is mentioned in the linked paper.
- gpderetta 3y agoSome optimizations are allowed within the rules of the memory model. For example, for an atomic x: x=1 x=2 Can be changed to just x=2. Still forward progress and eventual visibility must be guaranteed.