Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Re: gcc compiler bad behaviour

2012-04-14 by Bob Paddock

> --- In AVR-Chat@yahoogroups.com, Bob Paddock <bob.paddock@...> wrote:

> > Volatile is never the solution to a problem with threads.
> Nonsense. The volatile attribute is precisely the solution for *any* situation where a variable can be changed by an outside actor - even if it is another task.

No. http://blog.regehr.org/archives/28 "Nine ways to break your
systems code using volatile"  See #8.

Volatile means that all reads and writes happen to an address, even if
the compiler thinks they are not needed.  This has nothing to do with
concurrent access, which you have pointed out.

 > As I noted, volatile doesn't address atomicity of access nor (as
you alluded to) does it address serialization of resource access.
Those are different problems with different solutions.

Correct.

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.