1.\" $NetBSD: pthread_schedparam.3,v 1.8 2017/07/03 21:32:51 wiz Exp $ 2.\" 3.\" Copyright (c) 2002 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 14.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 15.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 17.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 18.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 19.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 20.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 21.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 22.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 23.\" POSSIBILITY OF SUCH DAMAGE. 24.\" 25.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>. 26.\" All rights reserved. 27.\" 28.\" Redistribution and use in source and binary forms, with or without 29.\" modification, are permitted provided that the following conditions 30.\" are met: 31.\" 1. Redistributions of source code must retain the above copyright 32.\" notice(s), this list of conditions and the following disclaimer as 33.\" the first lines of this file unmodified other than the possible 34.\" addition of one or more copyright notices. 35.\" 2. Redistributions in binary form must reproduce the above copyright 36.\" notice(s), this list of conditions and the following disclaimer in 37.\" the documentation and/or other materials provided with the 38.\" distribution. 39.\" 40.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 41.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 42.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 43.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE 44.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 45.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 46.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 47.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 48.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 49.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 50.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51.\" 52.\" $FreeBSD: src/lib/libpthread/man/pthread_schedparam.3,v 1.7 2002/09/16 19:29:29 mini Exp $ 53.Dd July 9, 2010 54.Dt PTHREAD_SCHEDPARAM 3 55.Os 56.Sh NAME 57.Nm pthread_setschedparam , 58.Nm pthread_getschedparam 59.Nd thread scheduling parameter manipulation 60.Sh LIBRARY 61.Lb libpthread 62.Sh SYNOPSIS 63.In pthread.h 64.Ft int 65.Fn pthread_setschedparam "pthread_t thread" "int policy" "const struct sched_param *param" 66.Ft int 67.Fn pthread_getschedparam "pthread_t thread" "int * restrict policy" "struct sched_param * restrict param" 68.Sh DESCRIPTION 69The 70.Fn pthread_setschedparam 71and 72.Fn pthread_getschedparam 73functions set and get the scheduling parameters of individual threads. 74The scheduling policy for a thread can be: 75.Bl -tag -width SCHED_OTHER -offset indent 76.It Dv SCHED_FIFO 77First in, first out. 78.It Dv SCHED_RR 79Round-robin. 80.It Dv SCHED_OTHER 81The system default. 82.El 83.Pp 84The thread priority (accessed via 85.Va param->sched_priority ) 86must be at least 87.Dv PTHREAD_MIN_PRIORITY 88and no more than 89.Dv PTHREAD_MAX_PRIORITY . 90.Sh RETURN VALUES 91If successful, these functions return 0. 92Otherwise, an error number is returned to indicate the error. 93.Sh ERRORS 94.Fn pthread_setschedparam 95may fail if: 96.Bl -tag -width Er 97.It Bq Er EINVAL 98The value specified by 99.Va policy 100is invalid. 101.It Bq Er ENOTSUP 102Invalid value for scheduling parameters. 103.It Bq Er ESRCH 104Non-existent thread 105.Va thread . 106.El 107.Pp 108.Fn pthread_getschedparam 109may fail if: 110.Bl -tag -width Er 111.It Bq Er ESRCH 112Non-existent thread 113.Va thread . 114.El 115.Sh SEE ALSO 116.Xr pthread_attr_getschedparam 3 , 117.Xr sched 3 118.Sh STANDARDS 119Both functions conform to 120.St -p1003.1-2001 . 121