OSDN Git Service

(split) LDP: Update original to LDP v3.38.
[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 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\"
24 .TH PTHREAD_ATTR_SETSCHEDPARAM 3 2012-03-15 "Linux" "Linux Programmer's Manual"
25 .SH NAME
26 pthread_attr_setschedparam, pthread_attr_getschedparam \- set/get
27 scheduling parameter attributes in thread attributes object
28 .SH SYNOPSIS
29 .nf
30 .B #include <pthread.h>
31
32 .BI "int pthread_attr_setschedparam(pthread_attr_t *" attr ,
33 .BI "                               const struct sched_param *" param );
34 .BI "int pthread_attr_getschedparam(pthread_attr_t *" attr ,
35 .BI "                               struct sched_param *" param );
36 .sp
37 Compile and link with \fI\-pthread\fP.
38 .fi
39 .SH DESCRIPTION
40 The
41 .BR pthread_attr_setschedparam ()
42 function sets the scheduling parameter attributes of the
43 thread attributes object referred to by
44 .IR attr
45 to the values specified in the buffer pointed to by
46 .IR param .
47 These attributes determine the scheduling parameters of
48 a thread created using the thread attributes object
49 .IR attr .
50
51 The
52 .BR pthread_attr_getschedparam ()
53 returns the scheduling parameter attributes of the thread attributes object
54 .IR attr
55 in the buffer pointed to by
56 .IR param .
57
58 Scheduling parameters are maintained in the following structure:
59
60 .in +4n
61 .nf
62 struct sched_param {
63     int sched_priority;     /* Scheduling priority */
64 };
65 .fi
66 .in
67
68 As can be seen, only one scheduling parameter is supported.
69 For details of the permitted ranges for scheduling priorities
70 in each scheduling policy, see
71 .BR sched_setscheduler (2).
72 .SH RETURN VALUE
73 On success, these functions return 0;
74 on error, they return a nonzero error number.
75 .SH ERRORS
76 POSIX.1 documents
77 .B EINVAL
78 and
79 .B ENOTSUP
80 errors for
81 .BR pthread_attr_setschedparam ().
82 On Linux these functions always succeed
83 (but portable and future-proof applications should nevertheless
84 handle a possible error return).
85 .\" .SH VERSIONS
86 .\" Available since glibc 2.0.
87 .SH CONFORMING TO
88 POSIX.1-2001.
89 .SH NOTES
90 See
91 .BR pthread_attr_setschedpolicy (3)
92 for a list of the thread scheduling policies supported on Linux.
93 .SH EXAMPLE
94 See
95 .BR pthread_setschedparam (3).
96 .SH SEE ALSO
97 .BR sched_get_priority_min (2),
98 .BR sched_setscheduler (2),
99 .BR pthread_attr_init (3),
100 .BR pthread_attr_setinheritsched (3),
101 .BR pthread_attr_setschedpolicy (3),
102 .BR pthread_create (3),
103 .BR pthread_setschedparam (3),
104 .BR pthread_setschedprio (3),
105 .BR pthreads (7)