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

Function nxtask_exithook

sched/task/task_exithook.c:406–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404 ****************************************************************************/
405
406void nxtask_exithook(FAR struct tcb_s *tcb, int status)
407{
408#ifdef CONFIG_SCHED_DUMP_LEAK
409 struct mm_memdump_s dump =
410 {
411 tcb->pid,
412# if CONFIG_MM_BACKTRACE >= 0
413 0,
414 ULONG_MAX
415# endif
416 };
417#endif
418
419 /* Under certain conditions, nxtask_exithook() can be called multiple
420 * times. A bit in the TCB was set the first time this function was
421 * called. If that bit is set, then just exit doing nothing more..
422 */
423
424 DEBUGASSERT((tcb->flags & TCB_FLAG_EXIT_PROCESSING) != 0);
425
426 nxsched_dumponexit();
427
428 /* If the task was terminated by another task, it may be in an unknown
429 * state. Make some feeble effort to recover the state.
430 */
431
432 nxtask_recover(tcb);
433
434 /* Disable the scheduling function to prevent other tasks from
435 * being deleted after they are awakened
436 */
437
438 sched_lock();
439
440 /* Send the SIGCHLD signal to the parent task group */
441
442 nxtask_signalparent(tcb, status);
443
444 /* Wakeup any tasks waiting for this task to exit */
445
446 nxtask_exitwakeup(tcb, status);
447
448 sched_unlock();
449
450 /* Leave the task group. Perhaps discarding any un-reaped child
451 * status (no zombies here!)
452 */
453
454 group_leave(tcb);
455
456 /* Deallocate anything left in the TCB's queues */
457
458#ifdef CONFIG_ENABLE_ALL_SIGNALS
459 nxsig_cleanup(tcb); /* Deallocate Signal lists */
460#endif
461
462#ifdef CONFIG_SCHED_DUMP_LEAK
463 if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_KERNEL)

Callers 3

_exitFunction · 0.85
nxtask_terminateFunction · 0.85
nx_pthread_exitFunction · 0.85

Calls 9

nxsched_dumponexitFunction · 0.85
nxtask_recoverFunction · 0.85
sched_lockFunction · 0.85
nxtask_signalparentFunction · 0.85
sched_unlockFunction · 0.85
group_leaveFunction · 0.85
nxsig_cleanupFunction · 0.85
kmm_memdumpFunction · 0.85
umm_memdumpFunction · 0.50

Tested by

no test coverage detected