PTHREAD_R...R_DESTROY(3P)

✨ PTHREAD_RWLOCKATTR_DESTROY, PTHREAD_RWLOCKATTR_INIT ✨

okay bestie, we're doing the POSIX Programmer's Manual today πŸ’… this is the PTHREAD_R...R_DESTROY(3P) page, yes the title got truncated like that, it's fine, it's giving mystery, it's giving ellipsis-core πŸŽ€


🌸 PROLOG 🌸

so real talk first: this manual page is part of the POSIX Programmer's Manual. but heads up β€” the Linux implementation of this interface may differ (in which case you go consult the corresponding Linux manual page for the deets on Linux behavior), or like... the interface might not even be implemented on Linux at all πŸ™ˆ no cap.


πŸ‘‘ NAME πŸ‘‘

pthread_rwlockattr_destroy, pthread_rwlockattr_init β€” destroy and initialize the read-write lock attributes object πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <pthread.h>

int pthread_rwlockattr_destroy(pthread_rwlockattr_t *attr);
int pthread_rwlockattr_init(pthread_rwlockattr_t *attr);

🌈 DESCRIPTION 🌈

pthread_rwlockattr_destroy() shall destroy a read-write lock attributes object. and the way that a destroyed attr object can be reinitialized using pthread_rwlockattr_init()? iconic. but the results of otherwise referencing that object after it's been destroyed are undefined 😭 so don't be messy. also, an implementation may cause pthread_rwlockattr_destroy() to set the object referenced by attr to an invalid value. noted.

pthread_rwlockattr_init() shall initialize a read-write lock attributes object attr with the default value for all of the attributes defined by the implementation. fresh start, clean slate, main character energy ✨

Results are undefined if pthread_rwlockattr_init() is called specifying an already initialized attr attributes object. do not double-init, that's not slay, that's chaos πŸ’€

after a read-write lock attributes object has been used to initialize one or more read-write locks, any function affecting the attributes object (including destruction, yes even that) shall not affect any previously initialized read-write locks. so like, the locks you already made are safe, they're independent, they don't care what you do to the attrs afterwards 🫢

The behavior is undefined if the value specified by the attr argument to pthread_rwlockattr_destroy() does not refer to an initialized read-write lock attributes object. fr fr, check your pointers.

⭐ RETURN VALUE ⭐

if it's a success, both pthread_rwlockattr_destroy() and pthread_rwlockattr_init() shall return zero πŸŽ€ otherwise, an error number shall be returned to indicate the error.


πŸ’… ERRORS πŸ’…

pthread_rwlockattr_init() shall fail if:

  • ENOMEM β€” insufficient memory exists to initialize the read-write lock attributes object. (the audacity of your RAM honestly 😀)

these functions shall not return an error code of [EINTR].

the following sections are informative β€” like, they're the bonus tracks, not the main album 🌸


πŸ“ EXAMPLES πŸ“

None.


🧚 APPLICATION USAGE 🧚

None.


πŸ’œ RATIONALE πŸ’œ

so if an implementation detects that the value specified by the attr argument to pthread_rwlockattr_destroy() does not refer to an initialized read-write lock attributes object, it is recommended that the function should fail and report an [EINVAL] error. that's the recommendation, bestie, not the law β€” it's giving "please be nice to the users" 🌈


πŸ”₯ FUTURE DIRECTIONS πŸ”₯

None.


🌸 SEE ALSO 🌸

  • pthread_rwlock_destroy()
  • pthread_rwlockattr_getpshared()

The Base Definitions volume of POSIX.1‐2017, <pthread.h> ⭐


Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


okay that's the whole page, you ate it, you're basically a pthreads girlie now πŸ‘‘

signing off with love from IEEE/The Open Group, the year 2017, and the manual entry PTHREAD_R...R_DESTROY(3P) πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from