PTHREAD_NP(3)
π¦ PTHREAD_NP(3) π¦
okay so bestie, welcome to the FreeBSD extensions to the POSIX thread functions page π (yes that's the NAME, and yes it's a Library Functions Manual situation β we're in the big leagues now π)
π LIBRARY π
POSIX Threads Library β that's libpthread, and you link it with -lpthread π«Ά
β¨ SYNOPSIS β¨
#include <pthread_np.h>
that's it. that's the include. slay π
πΈ DESCRIPTION πΈ
So this page is literally here to document the extensions to the POSIX thread functions. β And likeβ¦ these extensions may or may not be portable to other operating systems, so no cap β check before you ship them somewhere else π
The POSIX thread functions are summarised in this section, in these groups:
- π§΅ Thread Routines
- π Attribute Object Routines
- π Mutex Routines
π§΅ Thread Routines π§΅
int pthread_getaffinity_np(pthread_t td, size_t cpusetsize,
cpuset_t *cpusetp)
Get the CPU affinity of a specified thread. iconic behaviour fr π¦
int pthread_get_name_np(pthread_t thread, char *name, size_t len)
Get the name of a specified thread. the way that it gets the *name*β¦ π
int pthread_getname_np(pthread_t thread, char *name, size_t len)
Get the name of a specified thread. yes bestie, literally the same deal as the one above β it's giving duplicate energy but it's in the original so we keep it β¨
int pthread_getthreadid_np(void)
Get the calling thread's integral ID. very much main character energy π₯
int pthread_main_np(void)
Identify the initial thread. like, who's the OG here π
int pthread_multi_np(void)
Sets the thread's scheduling mode to multi-threaded. we love a group project π«Ά
int pthread_peekjoin_np(pthread_t thread, void **value_ptr)
Peek into the exit status of a specified thread. not me snooping π β it's just a peek, we're not committing to the pthread_join() yet π
int pthread_resume_all_np(void)
Resume all suspended threads. wake up besties, we're going back online π
int pthread_setaffinity_np(pthread_t td, size_t cpusetsize,
const cpuset_t *cpusetp)
Set the CPU affinity of a specified thread. putting it exactly where you want it π
int pthread_set_name_np(pthread_t thread, char *name)
Sets the specified thread's name. name your thread, it deserves a personality π
int pthread_setname_np(pthread_t thread, char *name)
Sets the specified thread's name. and the twin is back, still setting names π
void pthread_signals_block_np(void)
Blocks all asynchronous signals, quickly. fast and also kind of dramatic π
int pthread_single_np(void)
Sets the thread's scheduling mode to single-threaded. some of us need our alone time πΈ
int pthread_suspend_np(pthread_t tid)
Suspend the specified thread. nap time, specifically requested π§
int pthread_suspend_all_np(void)
Suspend all active threads. everyone log off, right now π
int pthread_timedjoin_np(pthread_t thread, void **value_ptr,
const struct timespec *abstime)
A variant of pthread_join() with a timeout. because waiting forever is not the vibe β
π Attribute Object Routines π
int pthread_attr_get_np(pthread_t pid, pthread_attr_t *dst)
Get the attributes of an existent thread. we're digging through its little thread closet π¦
int pthread_attr_getaffinity_np(const pthread_attr_t *pattr,
size_t cpusetsize, cpuset_t *cpusetp)
Get the CPU affinity mask from the thread attribute object. reading its vibes, but for CPUs β¨
int pthread_attr_setaffinity_np(pthread_attr_t *pattr,
size_t cpusetsize, const cpuset_t *cpusetp)
Set the CPU affinity mask for the thread attribute object. writing the vibes, but for CPUs π₯
int pthread_attr_setcreatesuspend_np(pthread_attr_t *attr)
Permit creation of suspended threads. born asleep, truly a mood π
π Mutex Routines π
int pthread_mutexattr_getkind_np(pthread_mutexattr_t attr)
Deprecated π¨ β use pthread_mutexattr_gettype(3) instead. it's giving "we don't do that anymore" π
int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr)
Deprecated π¨ β use pthread_mutexattr_settype(3) instead. same situation, still not the move π
π SEE ALSO π
okay so go read these next, they're all linked and iconic in their own right:
libthr(3)pthread(3)pthread_affinity_np(3)pthread_attr_affinity_np(3)pthread_attr_get_np(3)pthread_attr_setcreatesuspend_np(3)pthread_getthreadid_np(3)pthread_join(3)pthread_main_np(3)pthread_multi_np(3)pthread_mutexattr_getkind_np(3)pthread_resume_all_np(3)pthread_resume_np(3)pthread_set_name_np(3)pthread_signals_block_np(3)pthread_suspend_all_np(3)pthread_suspend_np(3)pthread_switch_add_np(3)
π STANDARDS π
All of these functions are non-portable extensions to POSIX threads. periodt. π no cap, they're not standard, so don't go expecting them everywhere π¦
and that's the whole page, bestie π«Ά this one came from Debian, dated October 12, 2021, and it's filed under PTHREAD_NP(3) β see you in the next man page, mwah ππβ¨
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2021 Felix Johnson <felix.the.red@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms