44
edits
Changes
→Synchronization
=== Synchronization ===
==== Using Atomic ====
Another way to manage shared data access between multiple threads is through the use of the atomic structure defined in the <atomic> library.
Atomic in the C++11 library works very similarly to how Atomic works in OpenMP. In C++, atomic is used as a wrapper for a variable type in order to give the variable atomic properties - that is, it can only be written by one thread at a time.
==== Using Mutex ====
[[File:Cppmutexoutput.png | 300px]]