This is the mail archive of the gcc@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: Optimization of conditional access to globals: thread-unsafe?


> Frankly, you realise the consequences of volatile access, you have
> this comment:
>
>   /* Avoid reading __gthread_active twice on the main code path.  */
>   int __gthread_active_latest_value = __gthread_active;
>
>
> Now, do you really believe that every multithreaded program should use
> volatile, and then should copy shared data to temporal storage, just
> because volatile is such a hammer?

No, I just wanted to point out that "volatile" has a well-defined semantics 
and can be properly used for shared accesses.  In other words, it's not all
or nothing like your earlier message[*] seemed to imply.

[*] http://gcc.gnu.org/ml/gcc/2007-10/msg00663.html

-- 
Eric Botcazou


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