PTHREAD_M...IOCEILING(3P)
π PTHREAD_M...IOCEILING(3P) β POSIX Programmer's Manual π
okay bestie, come sit with me, we're reading a whole POSIX page together and honestly? it's giving β¨niche but importantβ¨. this is pthread_mutexattr_getprioceiling and pthread_mutexattr_setprioceiling, from the POSIX Programmer's Manual. π
πΈ PROLOG πΈ
so like, real talk first: this page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so if you're on Linux, go peek at the matching Linux man page for the actual tea β), or the interface might not even be implemented on Linux at all. no cap. π
π¦ NAME π¦
pthread_mutexattr_getprioceiling, pthread_mutexattr_setprioceiling β get and set the prioceiling attribute of the mutex attributes object (REALTIME THREADS). yes she's a realtime girlie π
β SYNOPSIS β
#include <pthread.h>
int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t
*restrict attr, int *restrict prioceiling);
int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr,
int prioceiling);
π DESCRIPTION π
so the way this works: pthread_mutexattr_getprioceiling() and pthread_mutexattr_setprioceiling() shall, respectively, get and set the priority ceiling attribute of a mutex attributes object pointed to by attr β and that object was previously created by pthread_mutexattr_init(). that's the origin story, periodt.
the prioceiling attribute holds the priority ceiling of initialized mutexes. the values of prioceiling are within the maximum range of priorities defined by SCHED_FIFO. π«Ά
and what does the prioceiling attribute actually mean? it defines the priority ceiling of initialized mutexes, which is the minimum priority level at which the critical section guarded by the mutex is executed. so to avoid priority inversion (the villain of this whole saga π), the priority ceiling of the mutex shall be set to a priority higher than or equal to the highest priority of all the threads that may lock that mutex. and again β the values of prioceiling are within the maximum range of priorities defined under the SCHED_FIFO scheduling policy.
β οΈ now the scary part, bestie: the behavior is undefined if the value specified by theattrargument topthread_mutexattr_getprioceiling()orpthread_mutexattr_setprioceiling()does not refer to an initialized mutex attributes object. so likeβ¦ init it first. fr fr. π
π RETURN VALUE π
upon successful completion, both pthread_mutexattr_getprioceiling() and pthread_mutexattr_setprioceiling() shall return zero. otherwise, an error number shall be returned to indicate the error. iconic behavior, zero means slay, anything else means we have a situation π¨
π₯ ERRORS π₯
these functions may fail if:
EINVALβ the value specified byprioceilingis invalid.EPERMβ the caller does not have the privilege to perform the operation. (no permission, no party π)
and listen β these functions shall not return an error code of [EINTR]. noted. β
the following sections are informative.
π EXAMPLES π
None. β yeah she said what she said. nothing here bestie, moving on π
π§ APPLICATION USAGE π§
None. β also nothing. two for two. π
π RATIONALE π
so the reasoning is: if an implementation detects that the value specified by the attr argument to pthread_mutexattr_getprioceiling() or pthread_mutexattr_setprioceiling() does not refer to an initialized mutex attributes object, it is recommended that the function should fail and report an [EINVAL] error. see? told you to init it. π
π FUTURE DIRECTIONS π
None. β the future isβ¦ empty of changes here. that's the vibe. πΈ
β¨ SEE ALSO β¨
pthread_cond_destroy()pthread_create()pthread_mutex_destroy()
The Base Definitions volume of POSIX.1β2017, <pthread.h>
π COPYRIGHT π
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, I'm so proud of you π«Άβ¨ this was brought to you by IEEE/The Open Group, 2017 β now go set your prioceiling responsibly, bestie π
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- 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-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms