
Versione migliorata dell'esempio 9.8, due funzioni vengono create e stampano su stdout
main.cpp@0:68b32e1c7187, 2022-04-06 (annotated)
- Committer:
- flombella
- Date:
- Wed Apr 06 14:18:44 2022 +0000
- Revision:
- 0:68b32e1c7187
Versione inziaile da testo Xiao
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
flombella | 0:68b32e1c7187 | 1 | // Example 9.9 |
flombella | 0:68b32e1c7187 | 2 | |
flombella | 0:68b32e1c7187 | 3 | #include "mbed.h" |
flombella | 0:68b32e1c7187 | 4 | #include "rtos.h" |
flombella | 0:68b32e1c7187 | 5 | |
flombella | 0:68b32e1c7187 | 6 | void fun_1(void const *args) { |
flombella | 0:68b32e1c7187 | 7 | while (true) { |
flombella | 0:68b32e1c7187 | 8 | printf("Thread 1 ... ... \n\r"); |
flombella | 0:68b32e1c7187 | 9 | Thread::wait(200); |
flombella | 0:68b32e1c7187 | 10 | } |
flombella | 0:68b32e1c7187 | 11 | } |
flombella | 0:68b32e1c7187 | 12 | |
flombella | 0:68b32e1c7187 | 13 | int main() { |
flombella | 0:68b32e1c7187 | 14 | Thread thread(fun_1); |
flombella | 0:68b32e1c7187 | 15 | |
flombella | 0:68b32e1c7187 | 16 | while (true) { |
flombella | 0:68b32e1c7187 | 17 | printf("Main Loop Thread ... ... \n\r"); |
flombella | 0:68b32e1c7187 | 18 | Thread::wait(100); |
flombella | 0:68b32e1c7187 | 19 | } |
flombella | 0:68b32e1c7187 | 20 | } |