複数のスレッドによってアクセスされているミューテックスによって保護されていない変数 (おそらく volatile とマークされている) が最終的に一貫するという一般的な標準 (ISO C または C++、または POSIX/SUS 仕様のいずれか) による保証はありますか?割り当てられている場合は?
具体的な例として、2 つのスレッドが変数 v を共有し、初期値がゼロであるとします。
Thread 1: v = 1
Thread 2: while(v == 0) yield();
Is thread 2 guaranteed to terminate eventually? Or can it conceivably spin forever because the cache coherency never kicks in and makes the assignment visible in thread 2's cache?
I'm aware the C and C++ standards (before C++0x) do not speak at all about threads or concurrency. But I'm curious if the C++0x memory model, or pthreads, or anything else, guarantees this. (Apparently this does actually work on Windows on 32-bit x86; I'm wondering if it's something that can be relied on generally or if it just happens to work there).