MCPcopy Create free account
hub / github.com/chyyuu/os_kernel_lab / new

Method new

user/src/bin/stackful_coroutine.rs:67–77  ·  view source on GitHub ↗
(id: usize)

Source from the content-addressed store, hash-verified

65
66impl 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
80impl Runtime {

Callers

nothing calls this directly

Calls 1

mapMethod · 0.45

Tested by

no test coverage detected