1*01869ca4Swiz.\" $NetBSD: pthread_schedparam.3,v 1.8 2017/07/03 21:32:51 wiz Exp $ 255818196Snathanw.\" 355818196Snathanw.\" Copyright (c) 2002 The NetBSD Foundation, Inc. 455818196Snathanw.\" All rights reserved. 555818196Snathanw.\" Redistribution and use in source and binary forms, with or without 655818196Snathanw.\" modification, are permitted provided that the following conditions 755818196Snathanw.\" are met: 855818196Snathanw.\" 1. Redistributions of source code must retain the above copyright 955818196Snathanw.\" notice, this list of conditions and the following disclaimer. 1055818196Snathanw.\" 2. Redistributions in binary form must reproduce the above copyright 1155818196Snathanw.\" notice, this list of conditions and the following disclaimer in the 1255818196Snathanw.\" documentation and/or other materials provided with the distribution. 1355818196Snathanw.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1455818196Snathanw.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 1555818196Snathanw.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1655818196Snathanw.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 1755818196Snathanw.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 1855818196Snathanw.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 1955818196Snathanw.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2055818196Snathanw.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2155818196Snathanw.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2255818196Snathanw.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2355818196Snathanw.\" POSSIBILITY OF SUCH DAMAGE. 2455818196Snathanw.\" 2555818196Snathanw.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>. 2655818196Snathanw.\" All rights reserved. 2755818196Snathanw.\" 2855818196Snathanw.\" Redistribution and use in source and binary forms, with or without 2955818196Snathanw.\" modification, are permitted provided that the following conditions 3055818196Snathanw.\" are met: 3155818196Snathanw.\" 1. Redistributions of source code must retain the above copyright 3255818196Snathanw.\" notice(s), this list of conditions and the following disclaimer as 3355818196Snathanw.\" the first lines of this file unmodified other than the possible 3455818196Snathanw.\" addition of one or more copyright notices. 3555818196Snathanw.\" 2. Redistributions in binary form must reproduce the above copyright 3655818196Snathanw.\" notice(s), this list of conditions and the following disclaimer in 3755818196Snathanw.\" the documentation and/or other materials provided with the 3855818196Snathanw.\" distribution. 3955818196Snathanw.\" 4055818196Snathanw.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 4155818196Snathanw.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4255818196Snathanw.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 4355818196Snathanw.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE 4455818196Snathanw.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 4555818196Snathanw.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 4655818196Snathanw.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 4755818196Snathanw.\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 4855818196Snathanw.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 4955818196Snathanw.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 5055818196Snathanw.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 5155818196Snathanw.\" 5255818196Snathanw.\" $FreeBSD: src/lib/libpthread/man/pthread_schedparam.3,v 1.7 2002/09/16 19:29:29 mini Exp $ 539c4ae7f5Sjruoho.Dd July 9, 2010 5455818196Snathanw.Dt PTHREAD_SCHEDPARAM 3 5555818196Snathanw.Os 5655818196Snathanw.Sh NAME 5755818196Snathanw.Nm pthread_setschedparam , 5855818196Snathanw.Nm pthread_getschedparam 5955818196Snathanw.Nd thread scheduling parameter manipulation 6055818196Snathanw.Sh LIBRARY 6155818196Snathanw.Lb libpthread 6255818196Snathanw.Sh SYNOPSIS 6355818196Snathanw.In pthread.h 6455818196Snathanw.Ft int 6555818196Snathanw.Fn pthread_setschedparam "pthread_t thread" "int policy" "const struct sched_param *param" 6655818196Snathanw.Ft int 679cf9c231Skleink.Fn pthread_getschedparam "pthread_t thread" "int * restrict policy" "struct sched_param * restrict param" 6855818196Snathanw.Sh DESCRIPTION 6955818196SnathanwThe 7055818196Snathanw.Fn pthread_setschedparam 7155818196Snathanwand 7255818196Snathanw.Fn pthread_getschedparam 7355818196Snathanwfunctions set and get the scheduling parameters of individual threads. 746218b6cbSjruohoThe scheduling policy for a thread can be: 756218b6cbSjruoho.Bl -tag -width SCHED_OTHER -offset indent 766218b6cbSjruoho.It Dv SCHED_FIFO 776218b6cbSjruohoFirst in, first out. 786218b6cbSjruoho.It Dv SCHED_RR 796218b6cbSjruohoRound-robin. 806218b6cbSjruoho.It Dv SCHED_OTHER 816218b6cbSjruohoThe system default. 826218b6cbSjruoho.El 836218b6cbSjruoho.Pp 8455818196SnathanwThe thread priority (accessed via 85*01869ca4Swiz.Va param->sched_priority ) 8655818196Snathanwmust be at least 8755818196Snathanw.Dv PTHREAD_MIN_PRIORITY 8855818196Snathanwand no more than 8955818196Snathanw.Dv PTHREAD_MAX_PRIORITY . 9055818196Snathanw.Sh RETURN VALUES 9155818196SnathanwIf successful, these functions return 0. 9255818196SnathanwOtherwise, an error number is returned to indicate the error. 9355818196Snathanw.Sh ERRORS 9455818196Snathanw.Fn pthread_setschedparam 9555818196Snathanwmay fail if: 9655818196Snathanw.Bl -tag -width Er 9755818196Snathanw.It Bq Er EINVAL 9855818196SnathanwThe value specified by 9955818196Snathanw.Va policy 10055818196Snathanwis invalid. 10155818196Snathanw.It Bq Er ENOTSUP 10255818196SnathanwInvalid value for scheduling parameters. 10355818196Snathanw.It Bq Er ESRCH 10455818196SnathanwNon-existent thread 10555818196Snathanw.Va thread . 10655818196Snathanw.El 10755818196Snathanw.Pp 10855818196Snathanw.Fn pthread_getschedparam 10955818196Snathanwmay fail if: 11055818196Snathanw.Bl -tag -width Er 11155818196Snathanw.It Bq Er ESRCH 11255818196SnathanwNon-existent thread 11355818196Snathanw.Va thread . 11455818196Snathanw.El 1156218b6cbSjruoho.Sh SEE ALSO 1166218b6cbSjruoho.Xr pthread_attr_getschedparam 3 , 1176218b6cbSjruoho.Xr sched 3 11855818196Snathanw.Sh STANDARDS 1199c4ae7f5SjruohoBoth functions conform to 1209c4ae7f5Sjruoho.St -p1003.1-2001 . 121