Re[3]: читаем про volatile
От: MaximE Великобритания  
Дата: 10.01.05 20:03
Оценка:
c-smile wrote:

> Здравствуйте, MaximE, Вы писали:

>
> Ну если ты не веришь хлопцам от MS, то вот тебе от GCC
>
>

>
> Atomicity
>
> .....Worse still, "smart" compilers like GCC will often perform optimizations that could eliminate the memory operations needed to ensure that other processors can see what this processor has done. Fortunately, both these problems can be remedied... leaving only the relationship between access efficiency and cache line size for us to worry about.
>
> Volatility
>
> To prevent GCC's optimizer from buffering values of shared memory objects in registers, all objects in shared memory should be declared as having types with the volatile attribute. If this is done, all shared object reads and writes that require just one word access will occur atomically.


Во первых, я нигде не отрицал того, что здесь буквально написано. Во-вторых, здесь ни слова ни про multithreading ни про visibility.

> (свой зуб шли заказным письмом)


Вышлю, когда ты мне напишешь, что volatile гарантирует что все процессоры будут видеть изменения над volatile переменными без барьеров памяти.

--
Maxim Yegorushkin
Posted via RSDN NNTP Server 1.9
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.