Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of rtos_semaphore by
Revision 4:388272bc6baf, committed 2015-05-08
- Comitter:
- cathal66
- Date:
- Fri May 08 10:24:54 2015 +0000
- Parent:
- 3:02e47d35a686
- Commit message:
- finished
Changed in this revision
--- 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
