]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/pthread_attr_setschedpolicy.3
man*/: srcfix (Use .P instead of .PP or .LP)
[thirdparty/man-pages.git] / man3 / pthread_attr_setschedpolicy.3
1 '\" t
2 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH pthread_attr_setschedpolicy 3 (date) "Linux man-pages (unreleased)"
8 .SH NAME
9 pthread_attr_setschedpolicy, pthread_attr_getschedpolicy \- set/get
10 scheduling policy attribute in thread attributes object
11 .SH LIBRARY
12 POSIX threads library
13 .RI ( libpthread ", " \-lpthread )
14 .SH SYNOPSIS
15 .nf
16 .B #include <pthread.h>
17 .P
18 .BI "int pthread_attr_setschedpolicy(pthread_attr_t *" attr ", int " policy );
19 .BI "int pthread_attr_getschedpolicy(const pthread_attr_t *restrict " attr ,
20 .BI " int *restrict " policy );
21 .fi
22 .SH DESCRIPTION
23 The
24 .BR pthread_attr_setschedpolicy ()
25 function sets the scheduling policy attribute of the
26 thread attributes object referred to by
27 .I attr
28 to the value specified in
29 .IR policy .
30 This attribute determines the scheduling policy of
31 a thread created using the thread attributes object
32 .IR attr .
33 .P
34 The supported values for
35 .I policy
36 are
37 .BR SCHED_FIFO ,
38 .BR SCHED_RR ,
39 and
40 .BR SCHED_OTHER ,
41 with the semantics described in
42 .BR sched (7).
43 .\" FIXME . pthread_setschedparam() places no restriction on the policy,
44 .\" but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER
45 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=7013
46 .P
47 The
48 .BR pthread_attr_getschedpolicy ()
49 returns the scheduling policy attribute of the thread attributes object
50 .I attr
51 in the buffer pointed to by
52 .IR policy .
53 .P
54 In order for the policy setting made by
55 .BR pthread_attr_setschedpolicy ()
56 to have effect when calling
57 .BR pthread_create (3),
58 the caller must use
59 .BR pthread_attr_setinheritsched (3)
60 to set the inherit-scheduler attribute of the attributes object
61 .I attr
62 to
63 .BR PTHREAD_EXPLICIT_SCHED .
64 .SH RETURN VALUE
65 On success, these functions return 0;
66 on error, they return a nonzero error number.
67 .SH ERRORS
68 .BR pthread_attr_setschedpolicy ()
69 can fail with the following error:
70 .TP
71 .B EINVAL
72 Invalid value in
73 .IR policy .
74 .P
75 POSIX.1 also documents an optional
76 .B ENOTSUP
77 error ("attempt was made to set the attribute to an unsupported value") for
78 .BR pthread_attr_setschedpolicy ().
79 .SH ATTRIBUTES
80 For an explanation of the terms used in this section, see
81 .BR attributes (7).
82 .TS
83 allbox;
84 lbx lb lb
85 l l l.
86 Interface Attribute Value
87 T{
88 .na
89 .nh
90 .BR pthread_attr_setschedpolicy (),
91 .BR pthread_attr_getschedpolicy ()
92 T} Thread safety MT-Safe
93 .TE
94 .SH STANDARDS
95 POSIX.1-2008.
96 .SH HISTORY
97 glibc 2.0.
98 POSIX.1-2001.
99 .SH EXAMPLES
100 See
101 .BR pthread_setschedparam (3).
102 .SH SEE ALSO
103 .ad l
104 .nh
105 .BR pthread_attr_init (3),
106 .BR pthread_attr_setinheritsched (3),
107 .BR pthread_attr_setschedparam (3),
108 .BR pthread_create (3),
109 .BR pthread_setschedparam (3),
110 .BR pthread_setschedprio (3),
111 .BR pthreads (7),
112 .BR sched (7)