ARM Shanghai IoT Team (Internal)
/
Semaphoreapp_JacobShi
test the function of the semaphore
Fork of rtos_semaphore by
main.cpp
- Committer:
- shiyilei
- Date:
- 2014-10-27
- Revision:
- 4:0acf7ac363a8
- Parent:
- 1:bdf73f017a77
File content as of revision 4:0acf7ac363a8:
/************************************************** *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 twoslots(2); void normal_task(void const *args) { while(1) { twoslots.wait(); printf("%s\n",(char*)args); Thread::wait(400); twoslots.release(); } } 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) { } }