ARM Shanghai IoT Team (Internal)
/
Semaphoreapp_JacobShi
test the function of the semaphore
Fork of rtos_semaphore by
Revision 4:0acf7ac363a8, committed 2014-10-27
- Comitter:
- shiyilei
- Date:
- Mon Oct 27 04:37:39 2014 +0000
- Parent:
- 3:02e47d35a686
- Commit message:
- test the function of the semaphore
Changed in this revision
--- a/main.cpp Tue Jun 04 16:05:26 2013 +0100 +++ b/main.cpp Mon Oct 27 04:37:39 2014 +0000 @@ -1,20 +1,41 @@ +/************************************************** +*file name : the test of the semaphore +*Creator :JacobShi +*Time:2014/10/27 +* Description :test the function of the semaphore + *************************************************/ #include "mbed.h" #include "rtos.h" +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); -Semaphore two_slots(2); +Semaphore twoslots(2); +void normal_task(void const *args) +{ -void test_thread(void const *name) { - while (true) { - two_slots.wait(); - printf("%s\n\r", (const char*)name); - Thread::wait(1000); - two_slots.release(); - } + while(1) + { + twoslots.wait(); + printf("%s\n",(char*)args); + Thread::wait(400); + twoslots.release(); + } + + } -int main (void) { - Thread t2(test_thread, (void *)"Th 2"); - Thread t3(test_thread, (void *)"Th 3"); - - test_thread((void *)"Th 1"); -} + +int main(void) +{ + + Thread task1_thread1(normal_task,(void *)"task1"); + Thread task2_thread2(normal_task,(void *)"task2"); + Thread task3_thread3(normal_task,(void *)"task3"); + + while(1) + { + + + } +} \ No newline at end of file
--- a/mbed-rtos.lib Tue Jun 04 16:05:26 2013 +0100 +++ b/mbed-rtos.lib Mon Oct 27 04:37:39 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed-rtos/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed-rtos/#e2da1b20a6d5
--- a/mbed.bld Tue Jun 04 16:05:26 2013 +0100 +++ b/mbed.bld Mon Oct 27 04:37:39 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1 \ No newline at end of file