News for hackers. Stuff that matters.
Re:No sane compiler would optimize atomics (2015) by Dylan16807 on Sunday July 11, 2021 @08:22PM (#27805660)
> If they have some hard minimum they require, then what do they expect me to do? Completely abstract from the system scheduler to make it happen?

What if they say the hard minimum is "occasionally"?

They're not holding you responsible for the scheduler, they just want you to leave it as possible. (and not be deliberately malicious, just in case that needs to be said)

Re:No sane compiler would optimize atomics (2015) by chrisseaton on Sunday July 11, 2021 @08:25PM (#27805672)
Isn't this already expressible with something like a yield statement between the two atomics?

If you need it - write it down! I can't guess your intentions as a compiler author!

Re:No sane compiler would optimize atomics (2015) by Dylan16807 on Sunday July 11, 2021 @10:49PM (#27806417)
A yield might be way too slow.

And sure, there should be a way to signal intentions. By my point is that there is a reasonable way to describe what certain people would expect by default.

Re:No sane compiler would optimize atomics (2015) by spacechild1 on Monday July 12, 2021 @05:30AM (#27808550)
“volatile std::atomic“ also works and is more clear, IMO.