(id: usize)
| 65 | |
| 66 | impl Task { |
| 67 | fn new(id: usize) -> Self { |
| 68 | // We initialize each task here and allocate the stack. This is not neccesary, |
| 69 | // we can allocate memory for it later, but it keeps complexity down and lets us focus on more interesting parts |
| 70 | // to do it here. The important part is that once allocated it MUST NOT move in memory. |
| 71 | Task { |
| 72 | id:id, |
| 73 | stack: vec![0_u8; DEFAULT_STACK_SIZE], |
| 74 | ctx: TaskContext::default(), |
| 75 | state: State::Available, |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | impl Runtime { |