Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 13:a68509ad3202, committed 2020-05-03
- Comitter:
- wssingle
- Date:
- Sun May 03 19:12:28 2020 +0000
- Parent:
- 12:4e3f46e615d9
- Commit message:
- Lab 8 part 3
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Mar 30 18:54:14 2020 +0000 +++ b/main.cpp Sun May 03 19:12:28 2020 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" +#include "rtos.h" + +Semaphore two_slots(2); + +void test_thread(void const *name) { + while (true) { + two_slots.wait(); + printf("%s\n\r", (const char*)name); + Thread::wait(1000); + two_slots.release(); + } +} + +int main (void) { + Thread t2; + Thread t3; + + t2.start(callback(test_thread, (void *)"Th 2")); + t3.start(callback(test_thread, (void *)"Th 3")); + + test_thread((void *)"Th 1"); +} \ No newline at end of file