MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sys_exit_group

Function sys_exit_group

components/lwp/lwp_syscall.c:352–370  ·  view source on GitHub ↗

* @brief Terminates all threads in the current thread group. * * This system call ends execution for all threads within the same thread group, * releasing resources such as memory and file descriptors. It is typically used * in multithreaded environments to ensure a clean exit for the entire process. * * @param value The exit code to be returned to the parent process. * @return sysret_t: re

Source from the content-addressed store, hash-verified

350 * @return sysret_t: return value of the system call execution.
351 */
352sysret_t sys_exit_group(int value)
353{
354 sysret_t rc = 0;
355 lwp_status_t lwp_status;
356 struct rt_lwp *lwp = lwp_self();
357
358 if (lwp)
359 {
360 lwp_status = LWP_CREATE_STAT_EXIT(value);
361 lwp_exit(lwp, lwp_status);
362 }
363 else
364 {
365 LOG_E("Can't find matching process of current thread");
366 rc = -EINVAL;
367 }
368
369 return rc;
370}
371
372/**
373 * @brief Terminates the calling thread and exits the process.

Callers 10

syscall_handlerFunction · 0.85
handle_userFunction · 0.85
_check_faultFunction · 0.85
check_user_faultFunction · 0.85

Calls 2

lwp_selfFunction · 0.85
lwp_exitFunction · 0.85

Tested by

no test coverage detected