PTHREAD_MAIN_NP(3)
π PTHREAD_MAIN_NP(3) β like, the am I the main character check for threads
okay so bestie, welcome to the pthread_main_np page, which lives in the Library Functions Manual section 3. It's a POSIX Threads Library girly β that's libpthread, and you link it with -lpthread. periodt.
β¨ NAME β¨
pthread_main_np β identify the initial thread ππ
π LIBRARY π
POSIX Threads Library β that's libpthread, and the link flag is -lpthread. Don't forget it or nothing works and you'll be sad π
πΈ SYNOPSIS πΈ
#include <pthread_np.h>
int
pthread_main_np(void);
π¦ DESCRIPTION π¦
So the pthread_main_np() function is what you use in a userland threads environment to identify the initial thread β like, the OG thread, the first one, the one that was there before all the other threads showed up. main character energy fr fr π
Its semantics are similar to Solaris's thr_main() function. iykyk β¨
π RETURN VALUES π
The pthread_main_np() function returns:
1β if the calling thread is the initial thread (slay, that's you π )0β if the calling thread is not the initial thread (not the main character today bestie π)-1β if the thread's initialization has not yet completed (give it a sec, it's still getting ready π«Ά)
π SEE ALSO π
π AUTHORS π
This manual page was written by Alexey Zelkin <phantom@FreeBSD.org>. iconic of them honestly π
ngl this page is from Debian, dated October 12, 2021, and it's the PTHREAD_MAIN_NP(3) page π hope that helped bestie, now go check if you're the initial thread π§β¨
π¦ 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