MCPcopy Create free account
hub / github.com/apache/nuttx / _exit

Function _exit

sched/task/exit.c:56–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 ****************************************************************************/
55
56void _exit(int status)
57{
58 FAR struct tcb_s *tcb = this_task();
59
60 /* Only the lower 8-bits of status are used */
61
62 status &= 0xff;
63
64#ifdef HAVE_GROUP_MEMBERS
65 /* Kill all of the children of the group, preserving only this thread.
66 * exit() is normally called from the main thread of the task. pthreads
67 * exit through a different mechanism.
68 */
69
70 if ((tcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL)
71 {
72 group_kill_children(tcb);
73 }
74
75#endif
76
77 /* Make sure that we are in a critical section with local interrupts.
78 * The IRQ state will be restored when the next task is started.
79 */
80
81 enter_critical_section();
82
83 /* Perform common task termination logic. This will get called again later
84 * through logic kicked off by up_exit().
85 *
86 * REVISIT: Tt should not be necessary to call this here, but releasing the
87 * task group (especially the group file list) requires that it is done
88 * here.
89 *
90 * The reason? up_exit removes the current process from the ready-to-run
91 * list and trying to execute code that depends on this_task() crashes at
92 * once, or does something very naughty.
93 */
94
95 tcb->flags |= TCB_FLAG_EXIT_PROCESSING;
96
97 nxtask_exithook(tcb, status);
98
99 up_exit(status);
100}

Callers 9

nxtask_deleteFunction · 0.70
execveFunction · 0.70
nxtask_startFunction · 0.70
nx_pthread_exitFunction · 0.50
exitFunction · 0.50
quick_exitFunction · 0.50
_ExitFunction · 0.50
abortFunction · 0.50

Calls 5

this_taskFunction · 0.85
group_kill_childrenFunction · 0.85
enter_critical_sectionFunction · 0.85
nxtask_exithookFunction · 0.85
up_exitFunction · 0.50

Tested by

no test coverage detected