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: SDFileSystem mbed-rtos mbed
Fork of FRDM-K64_Threads_copy by
main.cpp@4:8a7e0bc98db0, 2016-11-16 (annotated)
- Committer:
- julioefajardo
- Date:
- Wed Nov 16 02:54:46 2016 +0000
- Revision:
- 4:8a7e0bc98db0
- Parent:
- 3:8647bf7682b2
Test
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| julioefajardo | 3:8647bf7682b2 | 1 | #include <stdio.h> |
| Kojto | 0:e1c215fe231c | 2 | #include "mbed.h" |
| Kojto | 0:e1c215fe231c | 3 | #include "SDFileSystem.h" |
| julioefajardo | 3:8647bf7682b2 | 4 | #include "rtos.h" |
| Kojto | 0:e1c215fe231c | 5 | |
| julioefajardo | 4:8a7e0bc98db0 | 6 | Thread *threads[4]; |
| julioefajardo | 3:8647bf7682b2 | 7 | |
| julioefajardo | 3:8647bf7682b2 | 8 | void worker(void const *args); |
| julioefajardo | 3:8647bf7682b2 | 9 | |
| julioefajardo | 3:8647bf7682b2 | 10 | int main(){ |
| julioefajardo | 3:8647bf7682b2 | 11 | |
| julioefajardo | 4:8a7e0bc98db0 | 12 | for(int i=0;i<4;i++){ |
| julioefajardo | 4:8a7e0bc98db0 | 13 | threads[i] = new Thread(worker,(void *)(i+1)); |
| julioefajardo | 4:8a7e0bc98db0 | 14 | Thread::wait(500); |
| Kojto | 0:e1c215fe231c | 15 | } |
| julioefajardo | 3:8647bf7682b2 | 16 | |
| julioefajardo | 4:8a7e0bc98db0 | 17 | while(1){ |
| Kojto | 0:e1c215fe231c | 18 | } |
| julioefajardo | 4:8a7e0bc98db0 | 19 | } |
| julioefajardo | 4:8a7e0bc98db0 | 20 | |
| julioefajardo | 4:8a7e0bc98db0 | 21 | void worker(void const *args){ |
| julioefajardo | 4:8a7e0bc98db0 | 22 | while (true) { |
| julioefajardo | 4:8a7e0bc98db0 | 23 | Thread::wait(500); |
| julioefajardo | 4:8a7e0bc98db0 | 24 | osThreadYield(); |
| julioefajardo | 3:8647bf7682b2 | 25 | } |
| Kojto | 0:e1c215fe231c | 26 | } |
| Kojto | 0:e1c215fe231c | 27 | |
| Kojto | 0:e1c215fe231c | 28 | |
| Kojto | 0:e1c215fe231c | 29 |
