PTHREAD_MULTI_NP(3)
π PTHREAD_MULTI_NP(3) β bestie's guide to switching thread modes π§΅β¨
okay so this is a page from the Library Functions Manual, and it lives in the POSIX Threads Library β aka libpthread, which you link with -lpthread. no cap, that's the whole vibe. π«Ά
β¨ NAME β¨
pthread_multi_np, pthread_single_np β the two functions that let you flip your process between multi-threaded and single-threaded scheduling modes. it's giving "pause the whole group chat" vs "resume the whole group chat", honestly. π
π LIBRARY π
POSIX Threads Library (libpthread, -lpthread) β the one and only. π
πΈ SYNOPSIS πΈ
#include <pthread_np.h>
int
pthread_multi_np(void);
int
pthread_single_np(void);
two functions, zero arguments, and they both hand you back an int. simple. iconic. π₯
π« DESCRIPTION π«
so here's the tea. β
pthread_single_np()β this one switches the whole process into single-threaded mode, which literally means it suspends all threads except the current one. yes, everybody else goes to sleep, you're the main character now. π the semantics of this function are similar topthread_suspend_all_np(3).pthread_multi_np()β and this one switches the process back into multi-threaded mode. everybody wakes up, the party resumes, we're all back in the group chat. π the semantics of this function are similar topthread_resume_all_np(3).
that's it, that's the whole thing. no hidden agenda, no secret flags. π¦
β RETURN VALUES β
pthread_multi_np() and the pthread_single_np functions always return 0. like, always. they don't do the error thing. zero is the whole personality. πβ¨
π SEE ALSO π
go read those next, iykyk ππ
π AUTHORS π
this manual page was written by Alexey Zelkin <phantom@FreeBSD.org>. absolute legend behavior, we stan. ππ
tiny heads up, bestie: pthread_single_np() suspends all your other threads, so likeβ¦ know what you're doing before you hit that. it's powerful and it's real. π§ββοΈ
okay that's the page!! source is Debian, dated October 12, 2021, and it's the PTHREAD_MULTI_NP(3) page β mwah, slayed, periodt. πππ
π¦ 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