マルチスレッドプログラミング相談室 その3
■ このスレッドは過去ログ倉庫に格納されています
0280デフォルトの名無しさん
05/02/08 11:03:11に,
One use of the volatile qualifier is to provide access to memory locations used by
asynchronous processes such as interrupt handlers.
って書いてあるんだけど...
さらには,
http://www.microsoft.com/japan/msdn/library/default.asp?url=/japan/msdn/library/ja/vclang/html/_pluslang_const_and_volatile_pointers.asp?frame=true&hidetoc=true
では,
When a name is declared as volatile, the compiler reloads the value from memory
each time it is accessed by the program.
This dramatically reduces the possible optimizations.
However, when the state of an object can change unexpectedly,
t is the only way to ensure predictable program performance.
とあります.
少なくともVC++の場合は(気をつければ)volatile使うのもありなのでは?
もちろん,C++の規格上は,マルチスレッドとvolatileの関係なんか何も定められていないと思うけど.
親の敵がごとくvolatileを嫌っている理由を知りたいです.
■ このスレッドは過去ログ倉庫に格納されています