OSDN Git Service

(split) LDP: Update original to LDP v3.65
[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 2008-11-06 "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 CONFORMING TO
84 POSIX.1-2001.
85 .SH NOTES
86 For a description of the permissions required to, and the effect of,
87 changing a thread's scheduling priority,
88 and details of the permitted ranges for priorities
89 in each scheduling policy, see
90 .BR sched_setscheduler (2).
91 .SH SEE ALSO
92 .ad l
93 .nh
94 .BR getrlimit (2),
95 .BR sched_get_priority_min (2),
96 .BR sched_setscheduler (2),
97 .BR pthread_attr_init (3),
98 .BR pthread_attr_setinheritsched (3),
99 .BR pthread_attr_setschedparam (3),
100 .BR pthread_attr_setschedpolicy (3),
101 .BR pthread_create (3),
102 .BR pthread_self (3),
103 .BR pthread_setschedparam (3),
104 .BR pthreads (7)
105 .SH COLOPHON
106 This page is part of release 3.65 of the Linux
107 .I man-pages
108 project.
109 A description of the project,
110 and information about reporting bugs,
111 can be found at
112 \%http://www.kernel.org/doc/man\-pages/.