Basic example showing the Semaphore API
mbed 2 and mbed OS 5
This is an mbed 2 example. mbed OS 5 has integrated the mbed library with mbed-rtos. For an mbed-os example, please see:
Import programrtos_semaphore
semaphore example
Diff: main.cpp
- Revision:
- 4:ec4791bc6554
- Parent:
- 1:bdf73f017a77
- Child:
- 5:574f47121e8e
diff -r 02e47d35a686 -r ec4791bc6554 main.cpp --- a/main.cpp Tue Jun 04 16:05:26 2013 +0100 +++ b/main.cpp Wed Jan 11 14:39:06 2017 +0000 @@ -13,8 +13,11 @@ } int main (void) { - Thread t2(test_thread, (void *)"Th 2"); - Thread t3(test_thread, (void *)"Th 3"); - + 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"); }