PTHREAD_SUSPEND_NP(3)
β¨ PTHREAD_SUSPEND_NP β¨
okay so this is a page from the Library Functions Manual, and bestie, we're talking about pthread_suspend_np today β the little function that puts a thread to sleep on purpose π€ like it's taking a nap mid-group-chat.
π NAME π
pthread_suspend_np β suspend a thread π«Ά
π LIBRARY π
POSIX Threads Library (libpthread, -lpthread) β that's where she lives, no cap.
πΈ SYNOPSIS πΈ
#include <pthread_np.h>
int
pthread_suspend_np(pthread_t tid);
π¦ DESCRIPTION π¦
so like, pthread_suspend_np() is called on an active thread and it literally causes that thread to suspend. like, "girl, take a break" β periodt.
β οΈ okay this part is important so pay attention bestie: it is not safe for the caller ofpthread_suspend_np()to use any non-async signal safe functions β exceptpthread_resume_np(3)β until the suspended thread is resumed. unless, of course, measures are taken to ensure the thread is suspended at a safe point. no cap, this is the scary part π don't just go calling random stuff after suspending a thread, it's giving undefined vibes.
π RETURN VALUES π
if it works, pthread_suspend_np() returns 0 β slay π
otherwise, an error number comes back at you to indicate the error. rude but okay.
π₯ ERRORS π₯
pthread_suspend_np() will fail if:
[EDEADLK]β an attempt was made to suspend the current thread π like girl you can't suspend yourself, that's not the vibe, main character energy gone wrong.[EINVAL]β the value specified by the tid argument is invalid π not a real one bestie.[ESRCH]β no thread could be found corresponding to the thread ID specified by the tid argument π she's not here, she's gone, the thread ID matched nobody.
π SEE ALSO π
pthread_np(3), pthread_resume_all_np(3), pthread_resume_np(3), pthread_suspend_all_np(3) β the whole friend group, go read them too π§
π AUTHORS π
this manual page was written by Alexey Zelkin <phantom@FreeBSD.org> β king behaviour, we stan π«Άβ
okay that's the whole page, ily, go suspend some threads responsibly π
Debian Β· October 12, 2021 Β· PTHREAD_SUSPEND_NP(3) β bye bestie, see you in the man pages π
π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2003 Alexey Zelkin <phantom@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms