master
| 1 | #include <stdint.h> |
| 2 | |
| 3 | typedef struct { uint32_t pid; uint32_t state; } task_t; |
| 4 | |
| 5 | static task_t tasks[64]; |
| 6 | static uint32_t task_count; |
| 7 | |
| 8 | void schedule(void) { |
| 9 | for (uint32_t i = 0; i < task_count; i++) { |
| 10 | if (tasks[i].state == 1) { |
| 11 | /* pick the next runnable task */ |
| 12 | return; |
| 13 | } |
| 14 | } |
| 15 | } |
| 16 |
16 lines · 298 bytesLast updated 2 days ago