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

Function _thread_exit

components/lwp/lwp_pid.c:798–819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

796 */
797rt_inline rt_noreturn
798void _thread_exit(rt_lwp_t lwp, rt_thread_t thread)
799{
800 LWP_LOCK(lwp);
801 lwp->rt_rusage.ru_stime.tv_sec += thread->system_time / RT_TICK_PER_SECOND;
802 lwp->rt_rusage.ru_stime.tv_usec += thread->system_time % RT_TICK_PER_SECOND * (1000000 / RT_TICK_PER_SECOND);
803 lwp->rt_rusage.ru_utime.tv_sec += thread->user_time / RT_TICK_PER_SECOND;
804 lwp->rt_rusage.ru_utime.tv_usec += thread->user_time % RT_TICK_PER_SECOND * (1000000 / RT_TICK_PER_SECOND);
805 rt_list_remove(&thread->sibling);
806 LWP_UNLOCK(lwp);
807 lwp_futex_exit_robust_list(thread);
808
809 /**
810 * Note: the tid tree always hold a reference to thread, hence the tid must
811 * be release before cleanup of thread
812 */
813 lwp_tid_put(thread->tid);
814 thread->tid = 0;
815
816 rt_thread_delete(thread);
817 rt_schedule();
818 while (1) ;
819}
820
821/**
822 * @brief Clear child thread ID notification for parent process

Callers 2

lwp_exitFunction · 0.70
lwp_thread_exitFunction · 0.70

Calls 5

rt_list_removeFunction · 0.85
lwp_tid_putFunction · 0.85
rt_thread_deleteFunction · 0.85
rt_scheduleFunction · 0.50

Tested by

no test coverage detected