OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / pthread_attr_setschedpolicy.3
1 .\" Copyright (c) 2008 Linux Foundation, written by Michael Kerrisk
2 .\"     <mtk.manpages@gmail.com>
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .TH PTHREAD_ATTR_SETSCHEDPOLICY 3 2014-05-21 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 pthread_attr_setschedpolicy, pthread_attr_getschedpolicy \- set/get
29 scheduling policy attribute in thread attributes object
30 .SH SYNOPSIS
31 .nf
32 .B #include <pthread.h>
33
34 .BI "int pthread_attr_setschedpolicy(pthread_attr_t *" attr \
35 ", int " policy );
36 .BI "int pthread_attr_getschedpolicy(const pthread_attr_t *" attr \
37 ", int " *policy );
38 .sp
39 Compile and link with \fI\-pthread\fP.
40 .fi
41 .SH DESCRIPTION
42 The
43 .BR pthread_attr_setschedpolicy ()
44 function sets the scheduling policy attribute of the
45 thread attributes object referred to by
46 .IR attr
47 to the value specified in
48 .IR policy .
49 This attribute determines the scheduling policy of
50 a thread created using the thread attributes object
51 .IR attr .
52
53 The supported values for
54 .I policy
55 are
56 .BR SCHED_FIFO ,
57 .BR SCHED_RR ,
58 and
59 .BR SCHED_OTHER ,
60 with the semantics described in
61 .BR sched (7).
62 .\" FIXME . pthread_setschedparam() places no restriction on the policy,
63 .\" but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER
64 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=7013
65
66 The
67 .BR pthread_attr_getschedpolicy ()
68 returns the scheduling policy attribute of the thread attributes object
69 .IR attr
70 in the buffer pointed to by
71 .IR policy .
72
73 In order for the policy setting made by
74 .BR pthread_attr_setschedpolicy ()
75 to have effect when calling
76 .BR pthread_create (3),
77 the caller must use
78 .BR pthread_attr_setinheritsched (3)
79 to set the inherit-scheduler attribute of the attributes object
80 .I attr
81 to
82 .BR PTHREAD_EXPLICIT_SCHED .
83 .SH RETURN VALUE
84 On success, these functions return 0;
85 on error, they return a nonzero error number.
86 .SH ERRORS
87 .BR pthread_attr_setschedpolicy ()
88 can fail with the following error:
89 .TP
90 .B EINVAL
91 Invalid value in
92 .IR policy .
93 .PP
94 POSIX.1-2001 also documents an optional
95 .B ENOTSUP
96 error ("attempt was made to set the attribute to an unsupported value") for
97 .BR pthread_attr_setschedpolicy ().
98 .\" .SH VERSIONS
99 .\" Available since glibc 2.0.
100 .SH ATTRIBUTES
101 .SS Multithreading (see pthreads(7))
102 The
103 .BR pthread_attr_setschedpolicy ()
104 and
105 .BR pthread_attr_getschedpolicy ()
106 functions are thread-safe.
107 .SH CONFORMING TO
108 POSIX.1-2001.
109 .SH EXAMPLE
110 See
111 .BR pthread_setschedparam (3).
112 .SH SEE ALSO
113 .ad l
114 .nh
115 .BR pthread_attr_init (3),
116 .BR pthread_attr_setinheritsched (3),
117 .BR pthread_attr_setschedparam (3),
118 .BR pthread_create (3),
119 .BR pthread_setschedparam (3),
120 .BR pthread_setschedprio (3),
121 .BR pthreads (7),
122 .BR sched (7)
123 .SH COLOPHON
124 This page is part of release 3.79 of the Linux
125 .I man-pages
126 project.
127 A description of the project,
128 information about reporting bugs,
129 and the latest version of this page,
130 can be found at
131 \%http://www.kernel.org/doc/man\-pages/.