test the function of the semaphore

Dependencies:   mbed-rtos mbed

Fork of rtos_semaphore by mbed official

Revision:
4:0acf7ac363a8
Parent:
1:bdf73f017a77
diff -r 02e47d35a686 -r 0acf7ac363a8 main.cpp
--- 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