MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kthread_exit

Function kthread_exit

freebsd/kern/kern_kthread.c:334–368  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332}
333
334void
335kthread_exit(void)
336{
337 struct proc *p;
338 struct thread *td;
339
340 td = curthread;
341 p = td->td_proc;
342
343#ifdef HWPMC_HOOKS
344 if (PMC_SYSTEM_SAMPLING_ACTIVE())
345 PMC_CALL_HOOK_UNLOCKED(td, PMC_FN_THR_EXIT_LOG, NULL);
346#endif
347 /* A module may be waiting for us to exit. */
348 wakeup(td);
349
350 /*
351 * The last exiting thread in a kernel process must tear down
352 * the whole process.
353 */
354 PROC_LOCK(p);
355 if (p->p_numthreads == 1) {
356 PROC_UNLOCK(p);
357 kproc_exit(0);
358 }
359
360 if (p->p_sysent->sv_ontdexit != NULL)
361 p->p_sysent->sv_ontdexit(td);
362
363 tidhash_remove(td);
364 umtx_thread_exit(td);
365 tdsigcleanup(td);
366 PROC_SLOCK(p);
367 thread_exit();
368}
369
370/*
371 * Advise a kernel process to suspend (or resume) in its main loop.

Callers 7

fork_exitFunction · 0.70
taskqueue_thread_loopFunction · 0.70
ithread_loopFunction · 0.70
gtaskqueue_thread_loopFunction · 0.70
sysevent_workerFunction · 0.50
zvol_geom_workerFunction · 0.50
siftr_pkt_manager_threadFunction · 0.50

Calls 6

tidhash_removeFunction · 0.85
umtx_thread_exitFunction · 0.85
tdsigcleanupFunction · 0.85
thread_exitFunction · 0.85
wakeupFunction · 0.70
kproc_exitFunction · 0.70

Tested by

no test coverage detected