pthread_mu...setkind_np(3)

πŸ’… pthread_mu...setkind_np(3) πŸ’…

okay bestie, so this page is straight out of the Library Functions Manual, and it's literally titled pthread_mu...setkind_np(3). yes the name is truncated, that's just how it is, we move. 🫢


✨ NAME ✨

pthread_mutexattr_setkind_np, pthread_mutexattr_getkind_np β€” deprecated mutex creation attributes 😭

like... they still exist, but they're giving retirement home energy. pls read on.


🌸 SYNOPSIS 🌸

#include <pthread.h>

int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
int pthread_mutexattr_getkind_np(const pthread_mutexattr_t *attr,
                                 int *kind);

one sets, one gets. classic duo. dynamic duo. πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, and it's not the fun kind: these functions are deprecated. 🫠

instead, you want to use pthread_mutexattr_settype(3) and pthread_mutexattr_gettype(3). literally just go use those, they're the glow-up versions.

no cap, if you're writing new code and you reach for these, put your hand down. settype and gettype are right there bestie!! πŸ™ˆ

πŸ’– RETURN VALUE πŸ’–

  • pthread_mutexattr_getkind_np() β€” always returns 0. always. it's an absolute icon of consistency, it does not miss. πŸ’…
  • pthread_mutexattr_setkind_np() β€” returns 0 when it succeeds, and a non-zero error code when it errors out. so 0 = slay, non-zero = uh oh. 😭

πŸ”₯ ERRORS πŸ”₯

when pthread_mutexattr_setkind_np() messes up, it hands you back this error code:

  • EINVAL β€” kind is neither PTHREAD_MUTEX_FAST_NP nor PTHREAD_MUTEX_RECURSIVE_NP nor PTHREAD_MUTEX_ERRORCHECK_NP. in other words: you gave it a vibe it does not recognise, and it is not about to fw that. πŸ’€

🌈 SEE ALSO 🌈


πŸŽ€ bye bestie πŸŽ€

this was brought to you by Linux man-pages 6.20, dated 2025-05-17, and the title card said pthread_mu...setkind_np(3) the whole time. now go call pthread_mutexattr_settype(3) instead, ily, mwah. πŸ’œβœ¨

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms