THR_WAKE(2)
π THR_WAKE π
okay bestie, welcome to the thr_wake page from the System Calls Manual (section 2, the system-call girly section, iykyk) πΈ
β¨ NAME β¨
thr_wake β wake up the suspended thread π΄β‘οΈπ
π LIBRARY π
Standard C Library (libc, -lc) π«Ά
π SYNOPSIS π
#include <sys/thr.h>
int
thr_wake(long id);
π¦ DESCRIPTION π¦
okay so real talk: this function is intended for implementing threading. like, it's a backstage-pass situation, not a main-character situation for your average app. normal applications should be using pthread_cond_timedwait(3) together with pthread_cond_broadcast(3) for typical safe suspension with cooperation of the thread being suspended, or pthread_suspend_np(3) and pthread_resume_np(3) in some specific situations, instead. periodt π
now the actual tea β β passing the thread identifier of the calling thread (see thr_self(2)) to thr_wake() sets a thread's flag to cause the next signal-interruptible sleep of that thread in the kernel to fail immediately with the EINTR error. the flag is cleared by an interruptible sleep attempt or by a call to thr_suspend(2). this is used by the system threading library to implement cancellation. iconic, honestly π
if id is not equal to the current thread identifier, the specified thread is woken up if suspended by the thr_suspend system call. and if the thread is not suspended at the time of the thr_wake call? the wake is remembered and the next attempt of the thread to suspend itself with thr_suspend(2) results in immediate return with success. only one wake is remembered β no hoarding, bestie, it's a one-wake-at-a-time situation π
π₯ RETURN VALUES π₯
the thr_wake() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. classic π«
π ERRORS π
the thr_wake() operation returns these errors:
[ESRCH]β the specified thread was not found or does not belong to the process of the calling thread. like, she's not here, or she's not yours π
π SEE ALSO π
ps(1), thr_self(2), thr_suspend(2), pthread_cancel(3), pthread_resume_np(3), pthread_suspend_np(3)
π STANDARDS π
the thr_suspend() 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 like, it's giving "not officially in the club but doing the club's whole job" energy β
Debian π September 23, 2016 β that's the source and the date, bestie, and this page is officially a wrap π¦β¨π
π¦ 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) 2016 The FreeBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms