MCPcopy Index your code
hub / github.com/RT-Thread/rt-thread / sys_exit

Function sys_exit

components/lwp/lwp_syscall.c:386–403  ·  view source on GitHub ↗

* @brief Terminates the calling thread and exits the process. * * This system call ends the execution of the calling thread and the process * it belongs to. * * @param status The exit code to be returned to the parent process. * A value of 0 typically indicates successful execution, while * non-zero values indicate an error or specific exit condition. * @return

Source from the content-addressed store, hash-verified

384 * `sys_exit` only terminates the calling thread and the process.
385 */
386sysret_t sys_exit(int status)
387{
388 sysret_t rc = 0;
389 rt_thread_t tid;
390
391 tid = rt_thread_self();
392 if (tid && tid->lwp)
393 {
394 lwp_thread_exit(tid, status);
395 }
396 else
397 {
398 LOG_E("Can't find matching process of current thread");
399 rc = -EINVAL;
400 }
401
402 return rc;
403}
404
405/**
406 * @brief Reads data from a file descriptor into a buffer.

Callers

nothing calls this directly

Calls 2

rt_thread_selfFunction · 0.85
lwp_thread_exitFunction · 0.85

Tested by

no test coverage detected