almost 2 years ago

Concurrency系列(四): 與Synchronizes-With同在

從Java切入

synchronized keyword

• Mutual Exclusive
• 建立Happens Before關係

再來輪到C++

C++比Java討厭的地方在於，Java努力把各種底層的複雜性藏起來，讓上層的JVM提供一個一致的環境，得以達成Write Once, Run Anywhere的理想。但C++盡可能提供你所有你能做到的事情，即使你可能會誤用這些工具。

The library defines a number of atomic operations and operations on mutexes that are specially identified as synchronization operations. These operations play a special role in making assignments in one thread visible to another.