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

Function guard

user/src/bin/stackful_coroutine.rs:210–215  ·  view source on GitHub ↗

This is our guard function that we place on top of the stack. All this function does is set the state of our current task and then `yield` which will then schedule a new task to be run.

()

Source from the content-addressed store, hash-verified

208/// This is our guard function that we place on top of the stack. All this function does is set the
209/// state of our current task and then `yield` which will then schedule a new task to be run.
210fn guard() {
211 unsafe {
212 let rt_ptr = RUNTIME as *mut Runtime;
213 (*rt_ptr).t_return();
214 };
215}
216
217/// We know that Runtime is alive the length of the program and that we only access from one core
218/// (so no datarace). We yield execution of the current task by dereferencing a pointer to our

Callers

nothing calls this directly

Calls 1

t_returnMethod · 0.80

Tested by

no test coverage detected