Setting up the code

For the actual example, we'll maintain the exact same function names as the theoretical example we covered previously. The shared resource will be the function that's used to blink the LEDs. 

The shared LEDs are only an example. In practice, you'll often find that data that's been shared between tasks needs to be protected. There is also the chance that the multiple tasks may attempt to use the same hardware peripheral, in which case access to that resource may need to be protected.

To provide some visual feedback, we'll also assign some LEDs to the various tasks. Let's have a look at the code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.200.143