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.
()
| 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. |
| 210 | fn 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 |