PTHREAD_ATTR_GETSCOPE(3P)
π PTHREAD_ATTR_GETSCOPE(3P) π
okay so this is from the POSIX Programmer's Manual bestie, and we're doing pthread_attr_getscope and pthread_attr_setscope today. hold onto your scrunchie.
πΈ PROLOG πΈ
lowkey important heads up first: this page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so go check the corresponding Linux manual page for the deets on Linux behavior), or the interface may literally not be implemented on Linux at all. π
β¨ NAME β¨
pthread_attr_getscope, pthread_attr_setscope β get and set the contentionscope attribute (REALTIME THREADS) π§
π SYNOPSIS π
#include <pthread.h>
int pthread_attr_getscope(const pthread_attr_t *restrict attr,
int *restrict contentionscope);
int pthread_attr_setscope(pthread_attr_t *attr, int contentionscope);
π¦ DESCRIPTION π¦
so basically, pthread_attr_getscope() and pthread_attr_setscope() shall get and set (respectively, bestie, in that order) the contentionscope attribute inside the attr object. π«
the contentionscope attribute may have these values:
PTHREAD_SCOPE_SYSTEMβ signifying system scheduling contention scopePTHREAD_SCOPE_PROCESSβ signifying process scheduling contention scope
both of those symbols are defined in the <pthread.h> header, periodt.
π the behavior is undefined if the value specified by theattrargument topthread_attr_getscope()orpthread_attr_setscope()does not refer to an initialized thread attributes object. like, we're in undefined territory, not cute, do not do this.
π RETURN VALUE π
if it slays (successful), pthread_attr_getscope() and pthread_attr_setscope() shall return zero. otherwise, an error number shall be returned to indicate the error. π
π₯ ERRORS π₯
pthread_attr_setscope() shall fail if:
ENOTSUPβ an attempt was made to set the attribute to an unsupported value. π«
pthread_attr_setscope() may fail if:
EINVALβ the value ofcontentionscopeis not valid. π
also these functions shall not return an error code of [EINTR]. not a thing here.
the following sections are informative (iykyk).
π EXAMPLES π
None.
(yeah. that's it. nothing. the void. π«Ά)
π APPLICATION USAGE π
once these attributes have been set, a thread can be created with the specified attributes using pthread_create(). and the way that using these routines does not affect the current running thread? iconic, honestly.
see Section 2.9.4, Thread Scheduling for further details on thread scheduling attributes and their default settings. go read it, bestie, it's giving homework but it's worth it. π
β RATIONALE β
if an implementation detects that the value specified by the attr argument to pthread_attr_getscope() or pthread_attr_setscope() does not refer to an initialized thread attributes object, it is recommended that the function should fail and report an [EINVAL] error. like, if you're gonna catch it, catch it properly. π
π FUTURE DIRECTIONS π
None.
π SEE ALSO π
pthread_attr_destroy()pthread_attr_getinheritsched()pthread_attr_getschedpolicy()pthread_attr_getschedparam()pthread_create()
and from the Base Definitions volume of POSIX.1β2017: <pthread.h>, <sched.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 that bestie π«Ά this was IEEE/The Open Group, 2017, and we were reading PTHREAD_ATTR_GETSCOPE(3P) the entire time. mwah. πβ¨
π¦ 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