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.
Dependencies: C12832_lcd mbed-rtos mbed
Fork of rtos_mutex by
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 #include "C12832_lcd.h" 00004 00005 C12832_LCD lcd; 00006 Mutex lcd_mutex; 00007 00008 void mu_write(const char* name) { 00009 Thread::wait(rand()/1000000); 00010 lcd_mutex.lock(); 00011 lcd.locate(0,3); 00012 lcd.printf("%s writing\n\r", name); 00013 Thread::wait(1000); 00014 lcd.cls(); 00015 lcd_mutex.unlock(); 00016 } 00017 00018 void test_thread(void const *args) { 00019 while (true) { 00020 mu_write((const char*)args); 00021 } 00022 } 00023 00024 int main() { 00025 lcd.cls(); 00026 Thread t2(test_thread, (void *)"Th 2"); 00027 Thread t3(test_thread, (void *)"Th 3"); 00028 Thread t4(test_thread, (void *)"Th 4"); 00029 00030 test_thread((void *)"Th 1"); 00031 }
Generated on Sat Jul 16 2022 00:45:25 by
1.7.2
