OSDN Git Service

5a183e70d6dc2c2529fbef4f6cb3d93f0150212d
[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 .\" 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_SETSCHEDPOLICY 3 2010-02-03 "Linux" "Linux Programmer's Manual"
25 .SH NAME
26 pthread_attr_setschedpolicy, pthread_attr_getschedpolicy \- set/get
27 scheduling policy attribute in thread attributes object
28 .SH SYNOPSIS
29 .nf
30 .B #include <pthread.h>
31
32 .BI "int pthread_attr_setschedpolicy(pthread_attr_t *" attr \
33 ", int " policy );
34 .BI "int pthread_attr_getschedpolicy(pthread_attr_t *" attr \
35 ", int " *policy );
36 .sp
37 Compile and link with \fI\-pthread\fP.
38 .SH DESCRIPTION
39 The
40 .BR pthread_attr_setschedpolicy ()
41 function sets the scheduling policy attribute of the
42 thread attributes object referred to by
43 .IR attr
44 to the value specified in
45 .IR policy .
46 This attribute determines the scheduling policy of
47 a thread created using the thread attributes object
48 .IR attr .
49
50 The supported values for
51 .I policy
52 are
53 .BR SCHED_FIFO ,
54 .BR SCHED_RR ,
55 and
56 .BR SCHED_OTHER ,
57 with the semantics described in
58 .BR sched_setscheduler (2).
59 .\" FIXME . pthread_setschedparam() places no restriction on the policy,
60 .\" but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER
61 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=7013
62
63 The
64 .BR pthread_attr_getschedpolicy ()
65 returns the scheduling policy attribute of the thread attributes object
66 .IR attr
67 in the buffer pointed to by
68 .IR policy .
69 .SH RETURN VALUE
70 On success, these functions return 0;
71 on error, they return a nonzero error number.
72 .SH ERRORS
73 .BR pthread_attr_setschedpolicy ()
74 can fail with the following error:
75 .TP
76 .B EINVAL
77 Invalid value in
78 .IR policy .
79 .PP
80 POSIX.1-2001 also documents an optional
81 .B ENOTSUP
82 error ("attempt was made to set the attribute to an unsupported value") for
83 .BR pthread_attr_setschedpolicy ().
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 SEE ALSO
92 .BR sched_setscheduler (2),
93 .BR pthread_attr_init (3),
94 .BR pthread_attr_setinheritsched (3),
95 .BR pthread_attr_setschedparam (3),
96 .BR pthread_create (3),
97 .BR pthread_setschedparam (3),
98 .BR pthread_setschedprio (3),
99 .BR pthreads (7)