diff --git a/redox-rt/src/thread.rs b/redox-rt/src/thread.rs index a63edeaf24..19b3efc66a 100644 --- a/redox-rt/src/thread.rs +++ b/redox-rt/src/thread.rs @@ -47,3 +47,11 @@ pub unsafe fn rlct_clone_impl(stack: *mut usize) -> Result { Ok(new_thr_fd) } + +pub fn exit_this_thread() -> ! { + let thread_fd = RtTcb::current().thread_fd(); + // TODO: modify interface so it writes directly to the thread fd? + let status_fd = syscall::dup(**thread_fd, b"status").unwrap(); + syscall::write(status_fd, &0_usize.to_ne_bytes()).unwrap(); + unreachable!() +} diff --git a/src/platform/redox/mod.rs b/src/platform/redox/mod.rs index 81b0d3345b..0729cc9858 100644 --- a/src/platform/redox/mod.rs +++ b/src/platform/redox/mod.rs @@ -1138,6 +1138,6 @@ impl Pal for Sys { } fn exit_thread() -> ! { - Self::exit(0) + redox_rt::thread::exit_this_thread() } }