feature: spawn for closures

This commit is contained in:
2021-11-19 16:14:13 +02:00
parent adb95ac52e
commit d582a9b58b
8 changed files with 171 additions and 44 deletions
+1
View File
@@ -6,6 +6,7 @@ pub const SYS_EX_SIGRETURN: usize = 131;
pub const SYS_EX_KILL: usize = 132;
pub const SYS_EX_CLONE: usize = 133;
pub const SYS_EX_YIELD: usize = 134;
pub const SYS_EX_THREAD_EXIT: usize = 135;
pub const SYS_EXIT: usize = 1;
pub const SYS_READ: usize = 2;
+8
View File
@@ -283,6 +283,14 @@ pub fn sys_ex_clone(entry: usize, stack: usize, arg: usize) -> Result<usize, Err
})
}
#[inline(always)]
pub fn sys_ex_thread_exit(status: ExitCode) -> ! {
unsafe {
syscall!(abi::SYS_EX_THREAD_EXIT, argn!(i32::from(status)));
}
unreachable!();
}
#[inline(always)]
pub fn sys_ex_yield() {
unsafe {