- To: gcc-help <gcc-help@xxxxxxxxxxx>
- Subject: volatile shared memory
- From: NightStrike <nightstrike@xxxxxxxxx>
- Date: Thu, 15 Mar 2012 14:56:57 -1000
- Comment: DKIM? See http://www.dkim.org
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
If I am interacting with shared memory, gcc doesn't know if another
process changes values. This creates issues for optimization. I know
that "volatile" can help address this, but it winds up causing a giant
mess of other problems (like, for instance, I can't pass a volatile
into memcpy.. or pretty much anything else from the standard
libraries).
So for instance, if I do something stupidly simple like busy-wait on a
shm value to change:
while (shm->index == oldindex) ;
gcc will kill that loop.
For simple things like this, and much more complicated things beyond
it, is there a way to cast something to "volatile" for one particular
usage?
[Linux C Programming]
[Linux Kernel]
[eCos]
[Fedora Development]
[Fedora Announce]
[Autoconf]
[The DWARVES Debugging Tools]
[Yosemite Campsites]
[Yosemite News]
[Linux GCC]