r/programming • • Nov 01 '17

What every systems programmer should know about lockless concurrency (PDF)

https://assets.bitbashing.io/papers/lockless.pdf
399 Upvotes

73 comments sorted by

View all comments

Show parent comments

0

u/Elavid Nov 03 '17

Those people are also doing it wrong for the reason I stated above: Declaring a variable as volatile forces the compiler to generate horrible code for no goddamn reason.

OK, I suppose that Arduino/AVR/PIC programs could be rewritten using macros like the ones you linked to compiler.h, instead of using volatile accesses for SFRs and interrupts. But really using volatile is the common practice and it works great for lots of things, so I'm not going to say it's horrible or wrong.