OSDN Git Service

(split) LDP: Update original to LDP v3.38.
[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 .fi
39 .SH DESCRIPTION
40 The
41 .BR pthread_attr_setschedpolicy ()
42 function sets the scheduling policy attribute of the
43 thread attributes object referred to by
44 .IR attr
45 to the value specified in
46 .IR policy .
47 This attribute determines the scheduling policy of
48 a thread created using the thread attributes object
49 .IR attr .
50
51 The supported values for
52 .I policy
53 are
54 .BR SCHED_FIFO ,
55 .BR SCHED_RR ,
56 and
57 .BR SCHED_OTHER ,
58 with the semantics described in
59 .BR sched_setscheduler (2).
60 .\" FIXME . pthread_setschedparam() places no restriction on the policy,
61 .\" but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER
62 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=7013
63
64 The
65 .BR pthread_attr_getschedpolicy ()
66 returns the scheduling policy attribute of the thread attributes object
67 .IR attr
68 in the buffer pointed to by
69 .IR policy .
70 .SH RETURN VALUE
71 On success, these functions return 0;
72 on error, they return a nonzero error number.
73 .SH ERRORS
74 .BR pthread_attr_setschedpolicy ()
75 can fail with the following error:
76 .TP
77 .B EINVAL
78 Invalid value in
79 .IR policy .
80 .PP
81 POSIX.1-2001 also documents an optional
82 .B ENOTSUP
83 error ("attempt was made to set the attribute to an unsupported value") for
84 .BR pthread_attr_setschedpolicy ().
85 .\" .SH VERSIONS
86 .\" Available since glibc 2.0.
87 .SH CONFORMING TO
88 POSIX.1-2001.
89 .SH EXAMPLE
90 See
91 .BR pthread_setschedparam (3).
92 .SH SEE ALSO
93 .BR sched_setscheduler (2),
94 .BR pthread_attr_init (3),
95 .BR pthread_attr_setinheritsched (3),
96 .BR pthread_attr_setschedparam (3),
97 .BR pthread_create (3),
98 .BR pthread_setschedparam (3),
99 .BR pthread_setschedprio (3),
100 .BR pthreads (7)