* @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
| 350 | * @return sysret_t: return value of the system call execution. |
| 351 | */ |
| 352 | sysret_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. |
no test coverage detected