THREAD_EXIT(9)
okay so bestie, welcome to THREAD_EXIT(9) β the Kernel Developer's Manual page that's all about yeeting the current thread context π β¨. If you're deep in kernel land and need to know how a thread says βbye, Iβm out,β this is your girl. Letβs get into it.
π NAME π
thread_exit β abandon current thread context π¦
π SYNOPSIS π
#include <sys/param.h>
#include <sys/proc.h>
void
thread_exit(void);
π DESCRIPTION π
okay so thread_exit() is the machine independent prelude to a thread shutdown. It is literally the opening act before the thread dips. It will not return, no cap β instead it will result in a call to mi_switch(9) to schedule some other thread. So yeah, once you call it, youβre not coming back; the scheduler is picking the next main character. periodt β¨
thread_exit() also arranges to free all the resources of the thread, specifically the kernel stack. Iconic cleanup behavior, honestly. π
To protectrunqueue(9),thread_exit()must be called with thesched_lockmutex held. Do not skip this, bestie β the runqueue needs its protection. π
π SEE ALSO π
This page came from Debian, dated July 5, 2002, and itβs THREAD_EXIT(9). Slay, kernel thread, slay πβ¨π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2002 Julian Elischer
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms