![](/media/cache/group/mbed-logo-square-512_3.png.50x50_q85.png)
semaphore example
Revision 7:755dee0042c3, committed 2018-02-02
- Comitter:
- Jennifer Plunkett
- Date:
- Fri Feb 02 15:14:15 2018 -0600
- Parent:
- 6:959c2b75861c
- Commit message:
- Fixed bug that made printf() unprotected
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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(); } }