summaryrefslogtreecommitdiffstats
path: root/man3/pthread_setschedparam.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/pthread_setschedparam.3')
-rw-r--r--man3/pthread_setschedparam.336
1 files changed, 18 insertions, 18 deletions
diff --git a/man3/pthread_setschedparam.3 b/man3/pthread_setschedparam.3
index 62a5832..5fdb307 100644
--- a/man3/pthread_setschedparam.3
+++ b/man3/pthread_setschedparam.3
@@ -4,7 +4,7 @@
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
-.TH pthread_setschedparam 3 2023-07-20 "Linux man-pages 6.05.01"
+.TH pthread_setschedparam 3 2023-10-31 "Linux man-pages 6.7"
.SH NAME
pthread_setschedparam, pthread_getschedparam \- set/get
scheduling policy and parameters of a thread
@@ -14,7 +14,7 @@ POSIX threads library
.SH SYNOPSIS
.nf
.B #include <pthread.h>
-.PP
+.P
.BI "int pthread_setschedparam(pthread_t " thread ", int " policy ,
.BI " const struct sched_param *" param );
.BI "int pthread_getschedparam(pthread_t " thread ", int *restrict " policy ,
@@ -25,7 +25,7 @@ The
.BR pthread_setschedparam ()
function sets the scheduling policy and parameters of the thread
.IR thread .
-.PP
+.P
.I policy
specifies the new scheduling policy for
.IR thread .
@@ -36,13 +36,13 @@ and their semantics, are described in
.\" 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
+.P
The structure pointed to by
.I param
specifies the new scheduling parameters for
.IR thread .
Scheduling parameters are maintained in the following structure:
-.PP
+.P
.in +4n
.EX
struct sched_param {
@@ -50,12 +50,12 @@ struct sched_param {
};
.EE
.in
-.PP
+.P
As can be seen, only one scheduling parameter is supported.
For details of the permitted ranges for scheduling priorities
in each scheduling policy, see
.BR sched (7).
-.PP
+.P
The
.BR pthread_getschedparam ()
function returns the scheduling policy and parameters of the thread
@@ -98,7 +98,7 @@ Both of these functions can fail with the following error:
No thread with the ID
.I thread
could be found.
-.PP
+.P
.BR pthread_setschedparam ()
may additionally fail with the following errors:
.TP
@@ -112,7 +112,7 @@ does not make sense for the
.B EPERM
The caller does not have appropriate privileges
to set the specified scheduling policy and parameters.
-.PP
+.P
POSIX.1 also documents an
.B ENOTSUP
("attempt was made to set the policy or scheduling parameters
@@ -133,7 +133,6 @@ T{
.BR pthread_getschedparam ()
T} Thread safety MT-Safe
.TE
-.sp 1
.SH STANDARDS
POSIX.1-2008.
.SH HISTORY
@@ -152,7 +151,7 @@ and
.BR pthread_getschedparam (),
as well as the use of a number of other scheduling-related
pthreads functions.
-.PP
+.P
In the following run, the main thread sets its scheduling policy to
.B SCHED_FIFO
with a priority of 10,
@@ -168,7 +167,7 @@ meaning that threads created using this attributes object should
take their scheduling attributes from the thread attributes object.
The program then creates a thread using the thread attributes object,
and that thread displays its scheduling policy and priority.
-.PP
+.P
.in +4n
.EX
$ \fBsu\fP # Need privilege to set real\-time scheduling policies
@@ -185,17 +184,17 @@ Scheduler attributes of new thread
policy=SCHED_RR, priority=20
.EE
.in
-.PP
+.P
In the above output, one can see that the scheduling policy and priority
were taken from the values specified in the thread attributes object.
-.PP
+.P
The next run is the same as the previous,
except that the inherit scheduler attribute is set to
.BR PTHREAD_INHERIT_SCHED ,
meaning that threads created using the thread attributes object should
ignore the scheduling attributes specified in the attributes object
and instead take their scheduling attributes from the creating thread.
-.PP
+.P
.in +4n
.EX
# \fB./a.out \-mf10 \-ar20 \-i i\fP
@@ -210,11 +209,11 @@ Scheduler attributes of new thread
policy=SCHED_FIFO, priority=10
.EE
.in
-.PP
+.P
In the above output, one can see that the scheduling policy and priority
were taken from the creating thread,
rather than the thread attributes object.
-.PP
+.P
Note that if we had omitted the
.I \-i\~i
option, the output would have been the same, since
@@ -235,6 +234,7 @@ is the default for the inherit scheduler attribute.
#define handle_error_en(en, msg) \e
do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)
\&
+[[noreturn]]
static void
usage(char *prog_name, char *msg)
{
@@ -270,7 +270,7 @@ get_policy(char p, int *policy)
}
\&
static void
-display_sched_attr(int policy, struct sched_param *param)
+display_sched_attr(int policy, const struct sched_param *param)
{
printf(" policy=%s, priority=%d\en",
(policy == SCHED_FIFO) ? "SCHED_FIFO" :