This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: how to cast away 'volatile'?


Andrew Haley wrote:
Michael Eager writes:
It can also be used to share data between threads, but it becomes
problematic if accesses are not atomic. It's reasonable to use a
shared volatile sig_atomic_t to communicate between threads, to say
"I'm done" or "Start processing".

Is that really safe, though? There's nothing to stop the machine from reordering memory writes, even if the compiler doesn't.

...my understanding is that is exactly what 'fence' is for. (Although I have yet to meet a processor that doesn't SIGILL when I try to use it :-). So I stick with e.g. 'lock or 0,%sp'...)


--
Matthew
HIPPOS feel unacknowledged. HIPPOS get angry.
> PRAISE HIPPOS
HIPPOS seem somewhat placated.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]