summaryrefslogtreecommitdiffstats
path: root/man3/pthread_attr_setschedpolicy.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/pthread_attr_setschedpolicy.3')
-rw-r--r--man3/pthread_attr_setschedpolicy.3113
1 files changed, 113 insertions, 0 deletions
diff --git a/man3/pthread_attr_setschedpolicy.3 b/man3/pthread_attr_setschedpolicy.3
new file mode 100644
index 0000000..9311af6
--- /dev/null
+++ b/man3/pthread_attr_setschedpolicy.3
@@ -0,0 +1,113 @@
+'\" t
+.\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
+.\" <mtk.manpages@gmail.com>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.TH pthread_attr_setschedpolicy 3 2023-07-20 "Linux man-pages 6.05.01"
+.SH NAME
+pthread_attr_setschedpolicy, pthread_attr_getschedpolicy \- set/get
+scheduling policy attribute in thread attributes object
+.SH LIBRARY
+POSIX threads library
+.RI ( libpthread ", " \-lpthread )
+.SH SYNOPSIS
+.nf
+.B #include <pthread.h>
+.PP
+.BI "int pthread_attr_setschedpolicy(pthread_attr_t *" attr ", int " policy );
+.BI "int pthread_attr_getschedpolicy(const pthread_attr_t *restrict " attr ,
+.BI " int *restrict " policy );
+.fi
+.SH DESCRIPTION
+The
+.BR pthread_attr_setschedpolicy ()
+function sets the scheduling policy attribute of the
+thread attributes object referred to by
+.I attr
+to the value specified in
+.IR policy .
+This attribute determines the scheduling policy of
+a thread created using the thread attributes object
+.IR attr .
+.PP
+The supported values for
+.I policy
+are
+.BR SCHED_FIFO ,
+.BR SCHED_RR ,
+and
+.BR SCHED_OTHER ,
+with the semantics described in
+.BR sched (7).
+.\" FIXME . pthread_setschedparam() places no restriction on the policy,
+.\" but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER
+.\" http://sourceware.org/bugzilla/show_bug.cgi?id=7013
+.PP
+The
+.BR pthread_attr_getschedpolicy ()
+returns the scheduling policy attribute of the thread attributes object
+.I attr
+in the buffer pointed to by
+.IR policy .
+.PP
+In order for the policy setting made by
+.BR pthread_attr_setschedpolicy ()
+to have effect when calling
+.BR pthread_create (3),
+the caller must use
+.BR pthread_attr_setinheritsched (3)
+to set the inherit-scheduler attribute of the attributes object
+.I attr
+to
+.BR PTHREAD_EXPLICIT_SCHED .
+.SH RETURN VALUE
+On success, these functions return 0;
+on error, they return a nonzero error number.
+.SH ERRORS
+.BR pthread_attr_setschedpolicy ()
+can fail with the following error:
+.TP
+.B EINVAL
+Invalid value in
+.IR policy .
+.PP
+POSIX.1 also documents an optional
+.B ENOTSUP
+error ("attempt was made to set the attribute to an unsupported value") for
+.BR pthread_attr_setschedpolicy ().
+.SH ATTRIBUTES
+For an explanation of the terms used in this section, see
+.BR attributes (7).
+.TS
+allbox;
+lbx lb lb
+l l l.
+Interface Attribute Value
+T{
+.na
+.nh
+.BR pthread_attr_setschedpolicy (),
+.BR pthread_attr_getschedpolicy ()
+T} Thread safety MT-Safe
+.TE
+.sp 1
+.SH STANDARDS
+POSIX.1-2008.
+.SH HISTORY
+glibc 2.0.
+POSIX.1-2001.
+.SH EXAMPLES
+See
+.BR pthread_setschedparam (3).
+.SH SEE ALSO
+.ad l
+.nh
+.BR pthread_attr_init (3),
+.BR pthread_attr_setinheritsched (3),
+.BR pthread_attr_setschedparam (3),
+.BR pthread_create (3),
+.BR pthread_setschedparam (3),
+.BR pthread_setschedprio (3),
+.BR pthreads (7),
+.BR sched (7)