Pre-requisite for this tutorial is having a basic understanding of what threads are and the main methods to synchronize them.
### Multithreading in Miosix
Miosix provides two different interfaces for creating and managing threads: the `pthread` API and a navite one. Here we will consider only the native one.
In order to spawn a new thread, the `create()` function is needed and it takes the following parameters
...
...
@@ -7,7 +10,7 @@ In order to spawn a new thread, the `create()` function is needed and it takes t
*`argv`: a `void*` pointer that is passed as a parameter to the entry point function.
*`options`: thread options, such ad `Thread::JOINABLE`. By default native threads are not joinable, which means they will never end. The `join()` method allows to wait for a thread to end its execution.
### Multithreaded LED Blink
##### Example: LED Blink
In this example two threads make two LEDs blink. The first one changes state two times every second while the second one is set "high" only when the on-board user button is pressed (the discovery's blue button).
...
...
@@ -74,6 +77,7 @@ A mutex can also be part of a data structure. Note that even if this is a struct
> :warning: **Try to always keep the critical section in which a mutex is locked as small as possible.**