Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_thread.c
Show First 20 Lines • Show All 266 Lines • ▼ Show 20 Lines | thread_init(void *mem, int size, int flags) | ||||
td = (struct thread *)mem; | td = (struct thread *)mem; | ||||
td->td_sleepqueue = sleepq_alloc(); | td->td_sleepqueue = sleepq_alloc(); | ||||
td->td_turnstile = turnstile_alloc(); | td->td_turnstile = turnstile_alloc(); | ||||
td->td_rlqe = NULL; | td->td_rlqe = NULL; | ||||
EVENTHANDLER_DIRECT_INVOKE(thread_init, td); | EVENTHANDLER_DIRECT_INVOKE(thread_init, td); | ||||
umtx_thread_init(td); | umtx_thread_init(td); | ||||
epoch_thread_init(td); | |||||
td->td_kstack = 0; | td->td_kstack = 0; | ||||
td->td_sel = NULL; | td->td_sel = NULL; | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Tear down type-stable parts of a thread (just before being discarded). | * Tear down type-stable parts of a thread (just before being discarded). | ||||
*/ | */ | ||||
static void | static void | ||||
thread_fini(void *mem, int size) | thread_fini(void *mem, int size) | ||||
{ | { | ||||
struct thread *td; | struct thread *td; | ||||
td = (struct thread *)mem; | td = (struct thread *)mem; | ||||
EVENTHANDLER_DIRECT_INVOKE(thread_fini, td); | EVENTHANDLER_DIRECT_INVOKE(thread_fini, td); | ||||
rlqentry_free(td->td_rlqe); | rlqentry_free(td->td_rlqe); | ||||
turnstile_free(td->td_turnstile); | turnstile_free(td->td_turnstile); | ||||
sleepq_free(td->td_sleepqueue); | sleepq_free(td->td_sleepqueue); | ||||
umtx_thread_fini(td); | umtx_thread_fini(td); | ||||
epoch_thread_fini(td); | |||||
seltdfini(td); | seltdfini(td); | ||||
} | } | ||||
/* | /* | ||||
* For a newly created process, | * For a newly created process, | ||||
* link up all the structures and its initial threads etc. | * link up all the structures and its initial threads etc. | ||||
* called from: | * called from: | ||||
* {arch}/{arch}/machdep.c {arch}_init(), init386() etc. | * {arch}/{arch}/machdep.c {arch}_init(), init386() etc. | ||||
▲ Show 20 Lines • Show All 963 Lines • Show Last 20 Lines |