tzfile.5, tzselect.8: sync from tzdb upstream
[man-pages.git] / man3 / pthread_attr_setschedpolicy.3
blobb6c2064079a51027dc5a53e5312a92203ea4df42
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 .PP
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 .PP
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 .PP
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 .PP
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
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 .PP
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 VERSIONS
80 .\" Available since glibc 2.0.
81 .SH ATTRIBUTES
82 For an explanation of the terms used in this section, see
83 .BR attributes (7).
84 .ad l
85 .nh
86 .TS
87 allbox;
88 lbx lb lb
89 l l l.
90 Interface       Attribute       Value
92 .BR pthread_attr_setschedpolicy (),
93 .BR pthread_attr_getschedpolicy ()
94 T}      Thread safety   MT-Safe
95 .TE
96 .hy
97 .ad
98 .sp 1
99 .SH STANDARDS
100 POSIX.1-2001, POSIX.1-2008.
101 .SH EXAMPLES
103 .BR pthread_setschedparam (3).
104 .SH SEE ALSO
105 .ad l
107 .BR pthread_attr_init (3),
108 .BR pthread_attr_setinheritsched (3),
109 .BR pthread_attr_setschedparam (3),
110 .BR pthread_create (3),
111 .BR pthread_setschedparam (3),
112 .BR pthread_setschedprio (3),
113 .BR pthreads (7),
114 .BR sched (7)