|
||
---|---|---|
.. | ||
inc | ||
src | ||
CMakeLists.txt | ||
Makefile | ||
README.md |
README.md
Mutex Example
This example shows how to use the mutex in TobudOS. The example creates two tasks, each of which increments the shared variable counter. To avoid race conditions, the example uses mutex api to protect the shared resource. The output of the example is
Task task1: Counter is 1
Task task2: Counter is 2
Task task2: Counter is 3
Task task1: Counter is 4
Task task1: Counter is 5
step1
make sure your develop environment.
cmake
and version greater than 3.8.2gcc
gdb
make
is installed
step2
make build
directory and compile in build
mkdir build && cd build
cmake ..
make
step3
run program !!
# in build directory
./mutex
other
you can copy this demo to other path, but if you want do it,
you need modify CMakeLists.txt
. find line
set(TINY_ROOT ../../../)
and modify path-to-tinyos
set(TINY_ROOT path-to-tinyos)