THREAD_EXIT(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ¦‹ thread_exit(9) β€” abandon current thread context πŸ¦‹

okay so this page is from the Kernel Developer's Manual, and the vibe is: a thread is clocking out for good πŸ’…βœ¨

🌸 NAME 🌸

thread_exit β€” abandon current thread context

✨ SYNOPSIS ✨

#include <sys/param.h>
#include <sys/proc.h>

void
thread_exit(void);

πŸ’– DESCRIPTION πŸ’–

The thread_exit() function is literally the machine independent prelude to a thread shutdown. It will not return β€” no cap, it is not coming back β€” and it will result in a call to mi_switch(9) to schedule some other thread. 🫢

thread_exit() arranges to free all the resources of the thread, specifically the kernel stack. Like, it is handling the cleanup, bestie 🧹✨

To protect runqueue(9), thread_exit() must be called with the sched_lock mutex held. This is not optional β€” hold that mutex. πŸ”’πŸ’€

πŸ”₯ SEE ALSO πŸ”₯


This page is from Debian, dated July 5, 2002 β€” mwah, historical icon behavior πŸ’…πŸŽ€

πŸ“¦ where this page comes from