Introduction to Shared Data
This lesson gives an introduction to how data can be shared between threads in C++.
We'll cover the following
You only need to think about synchronization if you have shared, mutable data because such data is prone to data races. If you have concurrent non-synchronised read and write access to data, your program will have undefined behavior. The easiest way to visualize concurrent, unsynchronized read and write operations is to write something to std::cout
. Let’s have a look:
Get hands-on with 1400+ tech skills courses.