PTHREAD...CEILING(3POSIX)

โœจ PTHREAD...CEILING โœจ

okay bestie, welcome to the POSIX Programmer's Manual ๐Ÿ’– โ€” this page is literally called PTHREAD...CEILING(3POSIX) and it's giving realtime-threads realness, no cap.


๐ŸŒธ PROLOG ๐ŸŒธ

This manual page is part of the POSIX Programmer's Manual. Heads up though, bestie: the Linux implementation of this interface may differ (so go consult the corresponding Linux manual page for the deets on Linux behavior), or the interface might not even be implemented on Linux at all. ๐Ÿ˜ญ


๐Ÿ’… NAME ๐Ÿ’…

pthread_mutexattr_getprioceiling, pthread_mutexattr_setprioceiling โ€” get and set the prioceiling attribute of the mutex attributes object (REALTIME THREADS ๐Ÿ”ฅ)


โœจ 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 like, pthread_mutexattr_getprioceiling() and pthread_mutexattr_setprioceiling() do the whole get-and-set thing respectively โ€” they get and set the priority ceiling attribute of a mutex attributes object pointed to by attr, which was previously created by the function pthread_mutexattr_init(). Periodt. ๐Ÿ‘‘

The prioceiling attribute contains the priority ceiling of initialized mutexes. The values of prioceiling live within the maximum range of priorities defined by SCHED_FIFO. ๐Ÿ“Š

Okay so here's the tea: the prioceiling attribute defines the priority ceiling of initialized mutexes, which is the minimum priority level at which the critical section guarded by the mutex is executed. And in order to avoid priority inversion (๐Ÿ’€ not that), 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 yes, the values of prioceiling are within the maximum range of priorities defined under the SCHED_FIFO scheduling policy. Slay.

โš ๏ธ The behavior is undefined if the value specified by the attr argument to pthread_mutexattr_getprioceiling() or pthread_mutexattr_setprioceiling() does not refer to an initialized mutex attributes object. Like, don't do that. Fr fr. ๐Ÿ™ˆ

๐Ÿ’– RETURN VALUE ๐Ÿ’–

Upon successful completion, pthread_mutexattr_getprioceiling() and pthread_mutexattr_setprioceiling() shall return zero ๐ŸŽ€ โ€” otherwise, an error number shall be returned to indicate the error.


๐ŸŒˆ ERRORS ๐ŸŒˆ

These functions may fail if:

  • EINVAL โ€” The value specified by prioceiling is invalid.
  • EPERM โ€” The caller does not have the privilege to perform the operation. (no permission, no party ๐Ÿšซ)

These functions shall not return an error code of [EINTR]. Not ever. ๐Ÿ’…

The following sections are informative. ๐Ÿ‘€


๐Ÿ“ EXAMPLES ๐Ÿ“

None.


๐Ÿงš APPLICATION USAGE ๐Ÿงš

None.


โญ RATIONALE โญ

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. Like, just fail loudly, that's the vibe. ๐Ÿ“ฃ


๐Ÿ”ฎ FUTURE DIRECTIONS ๐Ÿ”ฎ

None.


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

  • pthread_cond_destroy()
  • pthread_create()
  • pthread_mutex_destroy()

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 .


k that's the whole page bestie, mwah ๐Ÿ’‹ โ€” brought to you by IEEE/The Open Group, dated 2017, filed under PTHREAD...CEILING(3POSIX). ate and left no crumbs โœจ

๐Ÿ“ฆ where this page comes from