OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[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 .SH DESCRIPTION
35 The
36 .BR pthread_setschedprio ()
37 function sets the scheduling priority of the thread
38 .I thread
39 to the value specified in
40 .IR prio .
41 (By contrast
42 .BR pthread_setschedparam (3)
43 changes both the scheduling policy and priority of a thread.)
44 .\" FIXME . nptl/pthread_setschedprio.c has the following
45 .\"   /* If the thread should have higher priority because of some
46 .\"      PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
47 .\" Eventually (perhaps after writing the mutexattr pages), we
48 .\" may want to add something on the topic to this page.
49 .\" nptl/pthread_setschedparam.c has a similar case.
50 .SH RETURN VALUE
51 On success, this function returns 0;
52 on error, it returns a nonzero error number.
53 If
54 .BR pthread_setschedprio ()
55 fails, the scheduling priority of
56 .I thread
57 is not changed.
58 .SH ERRORS
59 .TP
60 .B EINVAL
61 .I prio
62 is not valid for the scheduling policy of the specified thread.
63 .TP
64 .B EPERM
65 The caller does not have appropriate privileges
66 to set the specified priority.
67 .TP
68 .B ESRCH
69 No thread with the ID
70 .I thread
71 could be found.
72 .PP
73 POSIX.1-2001 also documents an
74 .B ENOTSUP
75 ("attempt was made to set the priority
76 to an unsupported value") error for
77 .BR pthread_setschedparam ().
78 .SH VERSIONS
79 This function is available in glibc since version 2.3.4.
80 .SH CONFORMING TO
81 POSIX.1-2001.
82 .SH NOTES
83 For a description of the permissions required to, and the effect of,
84 changing a thread's scheduling priority,
85 and details of the permitted ranges for priorities
86 in each scheduling policy, see
87 .BR sched_setscheduler (2).
88 .SH SEE ALSO
89 .BR getrlimit (2),
90 .BR sched_get_priority_min (2),
91 .BR sched_setscheduler (2),
92 .BR pthread_attr_init (3),
93 .BR pthread_attr_setinheritsched (3),
94 .BR pthread_attr_setschedparam (3),
95 .BR pthread_attr_setschedpolicy (3),
96 .BR pthread_setschedparam (3),
97 .BR pthread_create (3),
98 .BR pthread_self (3),
99 .BR pthreads (7)