'\" te .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. .\" Copyright (c) 2001, the Institute of Electrical and Electronics Engineers, Inc. and The Open Group. All Rights Reserved. .\" Copyright 1991, 1992, 1994, The X/Open Company Ltd. .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html. .\" This notice shall appear on any product containing this material. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH pthread_getschedparam 3C "1 Apr 2008" "SunOS 5.11" "Standard C Library Functions" .SH NAME pthread_getschedparam, pthread_setschedparam \- access dynamic thread scheduling parameters .SH SYNOPSIS .LP .nf cc -mt [ \fIflag\fR... ] \fIfile\fR... -lpthread [ \fIlibrary\fR... ] #include \fBint\fR \fBpthread_getschedparam\fR(\fBpthread_t\fR \fIthread\fR, \fBint *restrict\fR \fIpolicy\fR, \fBstruct sched_param *restrict\fR \fIparam\fR); .fi .LP .nf \fBint\fR \fBpthread_setschedparam\fR(\fBpthread_t\fR \fIthread\fR, \fBint\fR \fIpolicy\fR, \fBconst struct sched_param *\fR\fIparam\fR); .fi .SH DESCRIPTION .sp .LP The \fBpthread_getschedparam()\fR and \fBpthread_setschedparam()\fR functions allow the scheduling policy and scheduling parameters of individual threads within a multithreaded process to be retrieved and set. Supported policies are : .sp .ne 2 .mk .na \fB\fBSCHED_OTHER\fR\fR .ad .RS 15n .rt traditional time-sharing scheduling class .RE .sp .ne 2 .mk .na \fB\fBSCHED_FIFO\fR\fR .ad .RS 15n .rt real-time class: run to completion .RE .sp .ne 2 .mk .na \fB\fBSCHED_RR\fR\fR .ad .RS 15n .rt real-time class: round-robin .RE .sp .ne 2 .mk .na \fB\fBSCHED_IA\fR\fR .ad .RS 15n .rt interactive time-sharing class .RE .sp .ne 2 .mk .na \fB\fBSCHED_FSS\fR\fR .ad .RS 15n .rt fair-share scheduling class .RE .sp .ne 2 .mk .na \fB\fBSCHED_FX\fR\fR .ad .RS 15n .rt fixed priority scheduling class .RE .sp .LP See \fBpthreads\fR(5). The affected scheduling parameter is the \fIsched_priority\fR member of the \fBsched_param\fR structure. .sp .LP The \fBpthread_getschedparam()\fR function retrieves the scheduling policy and scheduling parameters for the thread whose thread \fBID\fR is given by \fIthread\fR and stores those values in \fIpolicy\fR and \fIparam\fR, respectively. The priority value returned from \fBpthread_getschedparam()\fR is the value specified by the most recent \fBpthread_setschedparam()\fR or \fBpthread_create()\fR call affecting the target thread, and does not reflect any temporary adjustments to its priority as a result of any priority inheritance or ceiling functions. The \fBpthread_setschedparam()\fR function sets the scheduling policy and associated scheduling parameters for the thread whose thread \fBID\fR is given by \fIthread\fR to the policy and associated parameters provided in \fIpolicy\fR and \fIparam\fR, respectively. .sp .LP If the \fBpthread_setschedparam()\fR function fails, no scheduling parameters will be changed for the target thread. .SH RETURN VALUES .sp .LP If successful, the \fBpthread_getschedparam()\fR and \fBpthread_setschedparam()\fR functions return \fB0\fR. Otherwise, an error number is returned to indicate the error. .SH ERRORS .sp .LP The \fBpthread_getschedparam()\fR and \fBpthread_gsetschedparam()\fR functions will fail if: .sp .ne 2 .mk .na \fB\fBESRCH\fR\fR .ad .RS 9n .rt The value specified by \fIthread\fR does not refer to an existing thread. .RE .sp .LP The \fBpthread_setschedparam()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt The value specified by \fIpolicy\fR or one of the scheduling parameters associated with the scheduling policy \fIpolicy\fR is invalid. .RE .sp .ne 2 .mk .na \fB\fBEPERM\fR\fR .ad .RS 10n .rt The caller does not have the appropriate permission to set either the scheduling parameters or the scheduling policy of the specified thread. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelMT-Safe _ StandardSee \fBstandards\fR(5). .TE .SH SEE ALSO .sp .LP \fBpthread_attr_init\fR(3C), \fBsched_getparam\fR(3C), \fBsched_get_priority_max\fR(3C)\fBsched_get_priority_max\fR(3C), \fBsched_get_priority_min\fR(3C), \fBsched_setparam\fR(3C), \fBsched_getscheduler\fR(3C), \fBsched_setscheduler\fR(3C), \fBattributes\fR(5), \fBpthreads\fR(5), \fBstandards\fR(5)