OSDN Git Service

(split) LDP: Update original to LDP v3.38.
[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 .\" 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_SETSCHEDPRIO 3 2008-11-06 "Linux" "Linux Programmer's Manual"
25 .SH NAME
26 pthread_setschedprio \- set scheduling priority of a thread
27 .SH SYNOPSIS
28 .nf
29 .B #include <pthread.h>
30
31 .BI "pthread_setschedprio(pthread_t " thread ", int " prio );
32 .sp
33 Compile and link with \fI\-pthread\fP.
34 .fi
35 .SH DESCRIPTION
36 The
37 .BR pthread_setschedprio ()
38 function sets the scheduling priority of the thread
39 .I thread
40 to the value specified in
41 .IR prio .
42 (By contrast
43 .BR pthread_setschedparam (3)
44 changes both the scheduling policy and priority of a thread.)
45 .\" FIXME . nptl/pthread_setschedprio.c has the following
46 .\"   /* If the thread should have higher priority because of some
47 .\"      PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
48 .\" Eventually (perhaps after writing the mutexattr pages), we
49 .\" may want to add something on the topic to this page.
50 .\" nptl/pthread_setschedparam.c has a similar case.
51 .SH RETURN VALUE
52 On success, this function returns 0;
53 on error, it returns a nonzero error number.
54 If
55 .BR pthread_setschedprio ()
56 fails, the scheduling priority of
57 .I thread
58 is not changed.
59 .SH ERRORS
60 .TP
61 .B EINVAL
62 .I prio
63 is not valid for the scheduling policy of the specified thread.
64 .TP
65 .B EPERM
66 The caller does not have appropriate privileges
67 to set the specified priority.
68 .TP
69 .B ESRCH
70 No thread with the ID
71 .I thread
72 could be found.
73 .PP
74 POSIX.1-2001 also documents an
75 .B ENOTSUP
76 ("attempt was made to set the priority
77 to an unsupported value") error for
78 .BR pthread_setschedparam (3).
79 .SH VERSIONS
80 This function is available in glibc since version 2.3.4.
81 .SH CONFORMING TO
82 POSIX.1-2001.
83 .SH NOTES
84 For a description of the permissions required to, and the effect of,
85 changing a thread's scheduling priority,
86 and details of the permitted ranges for priorities
87 in each scheduling policy, see
88 .BR sched_setscheduler (2).
89 .SH SEE ALSO
90 .BR getrlimit (2),
91 .BR sched_get_priority_min (2),
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_attr_setschedpolicy (3),
97 .BR pthread_create (3),
98 .BR pthread_self (3),
99 .BR pthread_setschedparam (3),
100 .BR pthreads (7)