OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / pthread_attr_setschedparam.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_SETSCHEDPARAM 3 2014-05-21 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 pthread_attr_setschedparam, pthread_attr_getschedparam \- set/get
29 scheduling parameter attributes in thread attributes object
30 .SH SYNOPSIS
31 .nf
32 .B #include <pthread.h>
33
34 .BI "int pthread_attr_setschedparam(pthread_attr_t *" attr ,
35 .BI "                               const struct sched_param *" param );
36 .BI "int pthread_attr_getschedparam(const pthread_attr_t *" attr ,
37 .BI "                               struct sched_param *" param );
38 .sp
39 Compile and link with \fI\-pthread\fP.
40 .fi
41 .SH DESCRIPTION
42 The
43 .BR pthread_attr_setschedparam ()
44 function sets the scheduling parameter attributes of the
45 thread attributes object referred to by
46 .IR attr
47 to the values specified in the buffer pointed to by
48 .IR param .
49 These attributes determine the scheduling parameters of
50 a thread created using the thread attributes object
51 .IR attr .
52
53 The
54 .BR pthread_attr_getschedparam ()
55 returns the scheduling parameter attributes of the thread attributes object
56 .IR attr
57 in the buffer pointed to by
58 .IR param .
59
60 Scheduling parameters are maintained in the following structure:
61
62 .in +4n
63 .nf
64 struct sched_param {
65     int sched_priority;     /* Scheduling priority */
66 };
67 .fi
68 .in
69
70 As can be seen, only one scheduling parameter is supported.
71 For details of the permitted ranges for scheduling priorities
72 in each scheduling policy, see
73 .BR sched (7).
74
75 In order for the parameter setting made by
76 .BR pthread_attr_setschedparam ()
77 to have effect when calling
78 .BR pthread_create (3),
79 the caller must use
80 .BR pthread_attr_setinheritsched (3)
81 to set the inherit-scheduler attribute of the attributes object
82 .I attr
83 to
84 .BR PTHREAD_EXPLICIT_SCHED .
85 .SH RETURN VALUE
86 On success, these functions return 0;
87 on error, they return a nonzero error number.
88 .SH ERRORS
89 POSIX.1 documents
90 .B EINVAL
91 and
92 .B ENOTSUP
93 errors for
94 .BR pthread_attr_setschedparam ().
95 On Linux these functions always succeed
96 (but portable and future-proof applications should nevertheless
97 handle a possible error return).
98 .\" .SH VERSIONS
99 .\" Available since glibc 2.0.
100 .SH ATTRIBUTES
101 .SS Multithreading (see pthreads(7))
102 The
103 .BR pthread_attr_setschedparam ()
104 and
105 .BR pthread_attr_getschedparam ()
106 functions are thread-safe.
107 .SH CONFORMING TO
108 POSIX.1-2001.
109 .SH NOTES
110 See
111 .BR pthread_attr_setschedpolicy (3)
112 for a list of the thread scheduling policies supported on Linux.
113 .SH EXAMPLE
114 See
115 .BR pthread_setschedparam (3).
116 .SH SEE ALSO
117 .ad l
118 .nh
119 .BR sched_get_priority_min (2),
120 .BR pthread_attr_init (3),
121 .BR pthread_attr_setinheritsched (3),
122 .BR pthread_attr_setschedpolicy (3),
123 .BR pthread_create (3),
124 .BR pthread_setschedparam (3),
125 .BR pthread_setschedprio (3),
126 .BR pthreads (7),
127 .BR sched (7)
128 .SH COLOPHON
129 This page is part of release 3.79 of the Linux
130 .I man-pages
131 project.
132 A description of the project,
133 information about reporting bugs,
134 and the latest version of this page,
135 can be found at
136 \%http://www.kernel.org/doc/man\-pages/.