May 2020
Intermediate to advanced
496 pages
13h 54m
English
In our previous mutex example, the LEDs were the shared resource being protected by the mutex. Only one LED was able to blink at a time – either green or blue. It would perform the entire double blink before the next double blink.
Let's take a look at why this is important with a more realistic example. In the real world, you'll often find shared data structures and hardware peripherals among the most common resources that need to be protected.
Accessing a data structure in an atomic fashion is very important when the structure contains multiple pieces of data that must be correlated with one another. An example would be a multi-axis accelerometer providing three readings for the X, Y, and Z axes. In a high-speed ...