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

Function thread_wait

freebsd/kern/kern_thread.c:961–980  ·  view source on GitHub ↗

* Do any thread specific cleanups that may be needed in wait() * called with Giant, proc and schedlock not held. */

Source from the content-addressed store, hash-verified

959 * called with Giant, proc and schedlock not held.
960 */
961void
962thread_wait(struct proc *p)
963{
964 struct thread *td;
965
966 mtx_assert(&Giant, MA_NOTOWNED);
967 KASSERT(p->p_numthreads == 1, ("multiple threads in thread_wait()"));
968 KASSERT(p->p_exitthreads == 0, ("p_exitthreads leaking"));
969 td = FIRST_THREAD_IN_PROC(p);
970 /* Lock the last thread so we spin until it exits cpu_throw(). */
971 thread_lock(td);
972 thread_unlock(td);
973 lock_profile_thread_exit(td);
974 cpuset_rel(td->td_cpuset);
975 td->td_cpuset = NULL;
976 cpu_thread_clean(td);
977 thread_cow_free(td);
978 callout_drain(&td->td_slpcallout);
979 thread_reap(); /* check for zombie threads etc. */
980}
981
982/*
983 * Link a thread to a process.

Callers 1

proc_reapFunction · 0.85

Calls 6

mtx_assertFunction · 0.85
lock_profile_thread_exitFunction · 0.85
cpuset_relFunction · 0.85
thread_cow_freeFunction · 0.85
thread_reapFunction · 0.85
cpu_thread_cleanFunction · 0.50

Tested by

no test coverage detected