wasmer_wasix/syscalls/wasix/
thread_exit.rs

1use super::*;
2use crate::syscalls::*;
3
4/// ### `thread_exit()`
5/// Terminates the current running thread, if this is the last thread then
6/// the process will also exit with code 0.
7/// The exit code parameter is a left over from a previous version of this
8/// syscall, maintained here to keep the syscall backwards-compatible, but
9/// is otherwise unused.
10///
11/// This syscall does not return.
12#[instrument(level = "trace", skip_all, fields(%_exitcode), ret)]
13pub fn thread_exit(ctx: FunctionEnvMut<'_, WasiEnv>, _exitcode: u32) -> Result<(), WasiError> {
14    tracing::debug!(tid=%ctx.data().thread.id(), "thread exit");
15    Err(WasiError::ThreadExit)
16}