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_mutex by
main.cpp
00001 #include "mbed.h" 00002 #include "rtos.h" 00003 #include <string> 00004 #include "iostream" 00005 00006 Mutex stdio_mutex; 00007 string teststring; 00008 00009 void notify(const char* name, int state) { 00010 int counter; 00011 stdio_mutex.lock(); 00012 counter ++; 00013 teststring = "hallo welt %a" , counter; 00014 stdio_mutex.unlock(); 00015 } 00016 00017 void test_thread(void const *args) { 00018 while (true) { 00019 notify((const char*)args, 0); Thread::wait(1000); 00020 notify((const char*)args, 1); Thread::wait(1000); 00021 } 00022 } 00023 00024 int main() { 00025 Thread t2(test_thread, (void *)"Th 2"); 00026 00027 while (1) 00028 { 00029 stdio_mutex.lock(); 00030 printf( "%s" , teststring); 00031 stdio_mutex.unlock(); 00032 wait_ms(100); 00033 } 00034 00035 }
Generated on Sun Jul 17 2022 19:35:33 by
1.7.2
