OSDN Git Service

9b6ac5d8032add609a287360ee3e2fa5a50d1491
[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 2010-02-03 "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 .SH DESCRIPTION
39 The
40 .BR pthread_attr_setschedparam ()
41 function sets the scheduling parameter attributes of the
42 thread attributes object referred to by
43 .IR attr
44 to the values specified in the buffer pointed to by
45 .IR param .
46 These attributes determine the scheduling parameters of
47 a thread created using the thread attributes object
48 .IR attr .
49
50 The
51 .BR pthread_attr_getschedparam ()
52 returns the scheduling parameter attributes of the thread attributes object
53 .IR attr
54 in the buffer pointed to by
55 .IR param .
56
57 Scheduling parameters are maintained in the following structure:
58
59 .in +4n
60 .nf
61 struct sched_param {
62     int sched_priority;     /* Scheduling priority */
63 };
64 .fi
65 .in
66
67 As can be seen, only one scheduling parameter is supported.
68 For details of the permitted ranges for scheduling priorities
69 in each scheduling policy, see
70 .BR sched_setscheduler (2).
71 .SH RETURN VALUE
72 On success, these functions return 0;
73 on error, they return a nonzero error number.
74 .SH ERRORS
75 POSIX.1 documents
76 .B EINVAL
77 and
78 .B ENOTSUP
79 errors for
80 .BR pthread_attr_setschedparam ().
81 On Linux these functions always succeed
82 (but portable and future-proof applications should nevertheless
83 handle a possible error return).
84 .\" .SH VERSIONS
85 .\" Available since glibc 2.0.
86 .SH CONFORMING TO
87 POSIX.1-2001.
88 .SH EXAMPLE
89 See
90 .BR pthread_setschedparam (3).
91 .SH NOTES
92 See
93 .BR pthread_attr_setschedpolicy (3)
94 for a list of the thread scheduling policies supported on Linux.
95 .SH SEE ALSO
96 .BR sched_get_priority_min (2),
97 .BR sched_setscheduler (2),
98 .BR pthread_attr_init (3),
99 .BR pthread_attr_setinheritsched (3),
100 .BR pthread_attr_setschedpolicy (3),
101 .BR pthread_create (3),
102 .BR pthread_setschedparam (3),
103 .BR pthread_setschedprio (3),
104 .BR pthreads (7)