![](/media/cache/group/mbed-logo-square-512_3.png.50x50_q85.png)
semaphore example
Diff: main.cpp
- Revision:
- 7:755dee0042c3
- Parent:
- 5:574f47121e8e
diff -r 959c2b75861c -r 755dee0042c3 main.cpp --- a/main.cpp Fri Jun 23 14:46:38 2017 -0500 +++ b/main.cpp Fri Feb 02 15:14:15 2018 -0600 @@ -1,15 +1,15 @@ #include "mbed.h" -Semaphore two_slots(2); +Semaphore one_slot(1); Thread t2; Thread t3; - + void test_thread(void const *name) { while (true) { - two_slots.wait(); + one_slot.wait(); printf("%s\n\r", (const char*)name); wait(1); - two_slots.release(); + one_slot.release(); } }