PTHREAD_RWLOCK_DESTROY(3)

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

πŸ’… PTHREAD_RWLOCK_DESTROY(3) β€” Library Functions Manual πŸ’…

okay so bestie, welcome to the pthread_rwlock_destroy page ✨ this one lives in the Library Functions Manual, section 3, and it's lowkey the cleanup era of rwlock content πŸŽ€


🌸 NAME 🌸

pthread_rwlock_destroy β€” destroy a read/write lock πŸ¦‹

like, the read/write lock gets its moment to exit the chat ✨


πŸ’– LIBRARY πŸ’–

POSIX Threads Library (libpthread, -lpthread) 🫢

yup, that's the one. link it and you're golden πŸ’…


✨ SYNOPSIS ✨

#include <pthread.h>

int
pthread_rwlock_destroy(pthread_rwlock_t *lock);

that's the whole vibe. one lock pointer, one int coming back 😌


πŸŽ€ DESCRIPTION πŸŽ€

The pthread_rwlock_destroy() function is used to destroy a read/write lock that was previously created with pthread_rwlock_init(). 🌈

that's it. that's the whole thing. you made it with init, you un-make it with destroy. it's giving closure 🧚


⭐ RETURN VALUES ⭐

If successful, pthread_rwlock_destroy() will return zero 😌✨ zero is the good number, the slay number, the "we ate and left no crumbs" number πŸ’…

Otherwise an error number will be returned to indicate the error 😭 so if you get anything that isn't zero, that's a whole error number, not just a random int, bestie β€” read it accordingly πŸ‘‘


πŸ’€ ERRORS πŸ’€

not every destroy goes to plan, and here's the breakdown fr fr:

The pthread_rwlock_destroy() function will fail if:

  • [EPERM] β€” The caller does not have the privilege to perform the operation πŸ™ˆ like, security said no. take the L gracefully.

The pthread_rwlock_destroy() function may fail if:

  • [EBUSY] β€” The system has detected an attempt to destroy the object referenced by lock while it is locked πŸ”₯ bestie do NOT do this, the lock is literally still in use, this is not the moment.
  • [EINVAL] β€” The value specified by lock is invalid πŸ’€ check your pointer, bestie, that thing is not doing what you think it's doing.

πŸ¦‹ SEE ALSO πŸ¦‹

pthread_rwlock_init(3) β€” the origin story πŸ’– go read that one next, they're a matched set πŸ‘‘


πŸ‘‘ STANDARDS πŸ‘‘

The pthread_rwlock_destroy() function is expected to conform to Version 2 of the Single UNIX Specification (β€œSUSv2”) 🌟 certified iconic behaviour ✨


🌈 HISTORY 🌈

The pthread_rwlock_destroy() function first appeared in FreeBSD 3.0 ⭐ a true main character debut, no cap πŸŽ€


and that's the page, bestie 🫢 this one shipped from Debian, dated August 4, 1998 β€” old money, honestly πŸ’œ go forth and destroy your rwlocks responsibly βœ¨πŸ“

πŸ“¦ where this page comes from