PTHREAD_NP(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ¦‹ 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:


🌈 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