次のコード
using System.Threading;
class Test
{
volatile int counter = 0;
public void Increment()
{
Interlocked.Increment(ref counter);
}
}
次のコンパイラ警告が発生します。
"A reference to a volatile field will not be treated as volatile"
この警告を発するために、ここで何か間違ったことをしていますか? コンパイラ me がこれについて警告するのはなぜですか?