xref: /openbsd-src/lib/libpthread/man/pthread_schedparam.3 (revision d04ba2cc13092d56f44a5a662aee6f1effe0193d)
1*d04ba2ccSjmc.\" $OpenBSD: pthread_schedparam.3,v 1.6 2015/11/10 23:48:18 jmc Exp $
20ce605c5Sfgsch.\" Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
30ce605c5Sfgsch.\" All rights reserved.
40ce605c5Sfgsch.\"
50ce605c5Sfgsch.\" Redistribution and use in source and binary forms, with or without
60ce605c5Sfgsch.\" modification, are permitted provided that the following conditions
70ce605c5Sfgsch.\" are met:
80ce605c5Sfgsch.\" 1. Redistributions of source code must retain the above copyright
90ce605c5Sfgsch.\"    notice(s), this list of conditions and the following disclaimer as
100ce605c5Sfgsch.\"    the first lines of this file unmodified other than the possible
110ce605c5Sfgsch.\"    addition of one or more copyright notices.
120ce605c5Sfgsch.\" 2. Redistributions in binary form must reproduce the above copyright
130ce605c5Sfgsch.\"    notice(s), this list of conditions and the following disclaimer in
140ce605c5Sfgsch.\"    the documentation and/or other materials provided with the
150ce605c5Sfgsch.\"    distribution.
160ce605c5Sfgsch.\"
170ce605c5Sfgsch.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
180ce605c5Sfgsch.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
190ce605c5Sfgsch.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
200ce605c5Sfgsch.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
210ce605c5Sfgsch.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
220ce605c5Sfgsch.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
230ce605c5Sfgsch.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
240ce605c5Sfgsch.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
250ce605c5Sfgsch.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
260ce605c5Sfgsch.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
270ce605c5Sfgsch.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
280ce605c5Sfgsch.\"
290ce605c5Sfgsch.\" $FreeBSD: src/lib/libc_r/man/pthread_schedparam.3,v 1.4 2001/07/15 07:53:27 dd Exp $
30*d04ba2ccSjmc.Dd $Mdocdate: November 10 2015 $
31*d04ba2ccSjmc.Dt PTHREAD_SETSCHEDPARAM 3
320ce605c5Sfgsch.Os
330ce605c5Sfgsch.Sh NAME
340ce605c5Sfgsch.Nm pthread_setschedparam ,
350ce605c5Sfgsch.Nm pthread_getschedparam
360ce605c5Sfgsch.Nd thread scheduling parameter manipulation
370ce605c5Sfgsch.Sh SYNOPSIS
3886f9d4cdStedu.In pthread.h
390ce605c5Sfgsch.Ft int
400ce605c5Sfgsch.Fn pthread_setschedparam "pthread_t thread" "int policy" "const struct sched_param *param"
410ce605c5Sfgsch.Ft int
420ce605c5Sfgsch.Fn pthread_getschedparam "pthread_t thread" "int *policy" "struct sched_param *param"
430ce605c5Sfgsch.Sh DESCRIPTION
440ce605c5SfgschThe
450ce605c5Sfgsch.Fn pthread_setschedparam
460ce605c5Sfgschand
470ce605c5Sfgsch.Fn pthread_getschedparam
480ce605c5Sfgschfunctions set and get the scheduling parameters of individual threads.
490ce605c5SfgschThe scheduling policy for a thread can either be
500ce605c5Sfgsch.Dv SCHED_FIFO
510ce605c5Sfgsch(first in, first out) or
520ce605c5Sfgsch.Dv SCHED_RR
530ce605c5Sfgsch(round-robin).
540ce605c5SfgschThe thread priority (accessed via
550ce605c5Sfgsch.Va param->sched_priority )
56372e44f4Sfgschmust be within the range returned by the
57372e44f4Sfgsch.Fn sched_get_priority_min
58372e44f4Sfgschand
59372e44f4Sfgsch.Fn sched_get_priority_max
60372e44f4Sfgschfunctions.
610ce605c5Sfgsch.Sh RETURN VALUES
620ce605c5SfgschIf successful, these functions return 0.
630ce605c5SfgschOtherwise, an error number is returned to indicate the error.
640ce605c5Sfgsch.Sh ERRORS
650ce605c5Sfgsch.Fn pthread_setschedparam
660ce605c5Sfgschwill fail if:
670ce605c5Sfgsch.Bl -tag -width Er
680ce605c5Sfgsch.It Bq Er EINVAL
690ce605c5SfgschInvalid value for
700ce605c5Sfgsch.Va policy .
710ce605c5Sfgsch.It Bq Er ENOTSUP
720ce605c5SfgschInvalid value for scheduling parameters.
730ce605c5Sfgsch.It Bq Er ESRCH
740ce605c5SfgschNon-existent thread
750ce605c5Sfgsch.Va thread .
760ce605c5Sfgsch.El
770ce605c5Sfgsch.Pp
780ce605c5Sfgsch.Fn pthread_getschedparam
790ce605c5Sfgschwill fail if:
800ce605c5Sfgsch.Bl -tag -width Er
810ce605c5Sfgsch.It Bq Er ESRCH
820ce605c5SfgschNon-existent thread
830ce605c5Sfgsch.Va thread .
840ce605c5Sfgsch.El
85372e44f4Sfgsch.Sh SEE ALSO
86ee0afd73Sjmc.Xr sched_get_priority_max 3
870ce605c5Sfgsch.Sh STANDARDS
880ce605c5Sfgsch.Fn pthread_setschedparam
890ce605c5Sfgschand
900ce605c5Sfgsch.Fn pthread_getschedparam
910ce605c5Sfgschconform to
920ce605c5Sfgsch.St -susv2
93