finished

Dependencies:   mbed-rtos mbed

Fork of rtos_semaphore by mbed official

Files at this revision

API Documentation at this revision

Comitter:
cathal66
Date:
Fri May 08 10:24:54 2015 +0000
Parent:
3:02e47d35a686
Commit message:
finished

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Tue Jun 04 16:05:26 2013 +0100
+++ b/main.cpp	Fri May 08 10:24:54 2015 +0000
@@ -1,20 +1,20 @@
 #include "mbed.h"
 #include "rtos.h"
 
-Semaphore two_slots(2);
+Semaphore two_slots(2);                         //Setup the use of two semaphores
 
-void test_thread(void const *name) {
+void test_thread(void const *name) {            //setup thread function 
     while (true) {
-        two_slots.wait();
-        printf("%s\n\r", (const char*)name);
-        Thread::wait(1000);
-        two_slots.release();
+        two_slots.wait();                       //Wait to get a semaphore to use the 
+        printf("%s\n\r", (const char*)name);    //when have semaphore printf on serial of thread number
+        Thread::wait(1000);                     //thread wait
+        two_slots.release();                    //Release semaphore back to RTOS
     }
 }
 
 int main (void) {
-    Thread t2(test_thread, (void *)"Th 2");
-    Thread t3(test_thread, (void *)"Th 3");
+    Thread t2(test_thread, (void *)"Th 2");     //start thread
+    Thread t3(test_thread, (void *)"Th 3");     //start thread
     
-    test_thread((void *)"Th 1");
+    test_thread((void *)"Th 1");                //function call in main thread
 }
--- a/mbed-rtos.lib	Tue Jun 04 16:05:26 2013 +0100
+++ b/mbed-rtos.lib	Fri May 08 10:24:54 2015 +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/#83e169389a69
--- a/mbed.bld	Tue Jun 04 16:05:26 2013 +0100
+++ b/mbed.bld	Fri May 08 10:24:54 2015 +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/e188a91d3eaa
\ No newline at end of file