OSDN Git Service

2843e77d493d0e07bab75a9e91cd7dbf88ae835a
[linuxjm/LDP_man-pages.git] / original / man3 / pthread_setschedprio.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_SETSCHEDPRIO 3 2014-05-19 "Linux" "Linux Programmer's Manual"
27 .SH NAME
28 pthread_setschedprio \- set scheduling priority of a thread
29 .SH SYNOPSIS
30 .nf
31 .B #include <pthread.h>
32
33 .BI "pthread_setschedprio(pthread_t " thread ", int " prio );
34 .sp
35 Compile and link with \fI\-pthread\fP.
36 .fi
37 .SH DESCRIPTION
38 The
39 .BR pthread_setschedprio ()
40 function sets the scheduling priority of the thread
41 .I thread
42 to the value specified in
43 .IR prio .
44 (By contrast
45 .BR pthread_setschedparam (3)
46 changes both the scheduling policy and priority of a thread.)
47 .\" FIXME . nptl/pthread_setschedprio.c has the following
48 .\"   /* If the thread should have higher priority because of some
49 .\"      PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
50 .\" Eventually (perhaps after writing the mutexattr pages), we
51 .\" may want to add something on the topic to this page.
52 .\" nptl/pthread_setschedparam.c has a similar case.
53 .SH RETURN VALUE
54 On success, this function returns 0;
55 on error, it returns a nonzero error number.
56 If
57 .BR pthread_setschedprio ()
58 fails, the scheduling priority of
59 .I thread
60 is not changed.
61 .SH ERRORS
62 .TP
63 .B EINVAL
64 .I prio
65 is not valid for the scheduling policy of the specified thread.
66 .TP
67 .B EPERM
68 The caller does not have appropriate privileges
69 to set the specified priority.
70 .TP
71 .B ESRCH
72 No thread with the ID
73 .I thread
74 could be found.
75 .PP
76 POSIX.1-2001 also documents an
77 .B ENOTSUP
78 ("attempt was made to set the priority
79 to an unsupported value") error for
80 .BR pthread_setschedparam (3).
81 .SH VERSIONS
82 This function is available in glibc since version 2.3.4.
83 .SH ATTRIBUTES
84 .SS Multithreading (see pthreads(7))
85 The
86 .BR pthread_setschedprio ()
87 function is thread-safe.
88 .SH CONFORMING TO
89 POSIX.1-2001.
90 .SH NOTES
91 For a description of the permissions required to, and the effect of,
92 changing a thread's scheduling priority,
93 and details of the permitted ranges for priorities
94 in each scheduling policy, see
95 .BR sched (7).
96 .SH SEE ALSO
97 .ad l
98 .nh
99 .BR getrlimit (2),
100 .BR sched_get_priority_min (2),
101 .BR pthread_attr_init (3),
102 .BR pthread_attr_setinheritsched (3),
103 .BR pthread_attr_setschedparam (3),
104 .BR pthread_attr_setschedpolicy (3),
105 .BR pthread_create (3),
106 .BR pthread_self (3),
107 .BR pthread_setschedparam (3),
108 .BR pthreads (7),
109 .BR sched (7)
110 .SH COLOPHON
111 This page is part of release 3.67 of the Linux
112 .I man-pages
113 project.
114 A description of the project,
115 information about reporting bugs,
116 and the latest version of this page,
117 can be found at
118 \%http://www.kernel.org/doc/man\-pages/.