THR_EXIT(2)
π
THR_EXIT(2) β like, the thr_exit girlies' era
okay so real talk: this is from the System Calls Manual section 2, and it's literally the page for thr_exit, bestie. buckle up π
πΈ NAME
thr_exit β terminate current thread (yes, that's the whole gig. she ends threads. she's iconic like that β¨)
π¦ LIBRARY
Standard C Library (libc, -lc) β that's where she lives, no cap π
β¨ SYNOPSIS
#include <sys/thr.h>
void
thr_exit(long *state);
look at her. tiny signature, big main character energy π
π DESCRIPTION
okay so first thing first, bestie β this function is intended for implementing threading. normal applications should call pthread_exit(3) instead, fr fr. this one is for the plumbing, not for you to just vibe with π
The thr_exit() system call terminates the current kernel-scheduled thread. that's it. that's the tweet. π
If the state argument is not NULL, then the location pointed to by the argument gets updated with an arbitrary non-zero value, and an _umtx_op(2) UMTX_OP_WAKE operation is consequently performed on the location. so like, you leave a little β¨non-zeroβ¨ breadcrumb and then everyone waiting on that spot gets woken up. iconic behavior honestly π«Ά
β οΈ Attempts to terminate the last thread in the process are silently ignored. like, she just doesn't. use the _exit(2) syscall to terminate the process instead β that's the actual move for ending the whole thing, bestie π₯
π RETURN VALUES
The function does not return a value. periodt.
A return from the function indicates that the calling thread was the last one in the process β so if you ever get a return back, that's not a success story, that's just you being the final survivor π lowkey the plot of every apocalypse movie.
π SEE ALSO
_exit(2)_umtx_op(2)thr_kill(2)thr_kill2(2)thr_new(2)thr_self(2)thr_set_name(2)pthread_exit(3)
the whole friend group honestly π iykyk
π STANDARDS
The thr_exit() system call is non-standard and is used by 1:1 Threading Library (libthr, -lthr) to implement IEEE Std 1003.1-2001 (βPOSIX.1β) pthread(3) functionality. so she's not part of the standard, she's the girl behind the girl π§
πΈ HISTORY
The thr_exit() system call first appeared in FreeBSD 5.2. a legend was born, no notes π
and that's the whole page, bestie!! π this little Debian build is dated May 5, 2020, and it's still serving THR_EXIT(2) realness to this very day β slay, honestly β¨π¦π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 2016 The FreeBSD Foundation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms