volatile qualifier hurts single-threaded optimized case

Paolo Carlini pcarlini@suse.de
Wed Aug 30 09:25:00 GMT 2006


Benjamin Kosnik wrote:

>   static inline _Atomic_word
>   __attribute__ ((__unused__))
>-  __exchange_and_add_dispatch(volatile _Atomic_word* __mem, int __val)
>+  __exchange_and_add_dispatch(_Atomic_word* __mem, int __val)
>  
>
Agreed, but doing this means that in the improvements to rope that 
Richard (and Hans) also want we have to call __exchange_and_add and 
__atomic_add directly,  because in that case the involved memory 
locations are volatile and have to remain like that per Hans desiderata, 
I gather. More generally, the original __exchange_and_add and 
__atomic_add could be used also together with volatile memory and now 
calling the "old" functions becomes necessary, we should document that 
somewhere (if it weren't for this reason, everyone should always go 
through the dispatchers).

Paolo.



More information about the Libstdc++ mailing list