.TH PTHREAD_SETSCHEDPARAM 3 LinuxThreads .SH NAME pthread_setschedparam, pthread_getschedparam \- control thread scheduling parameters .SH SYNOPSIS .B #include .BI "int pthread_setschedparam(pthread_t " target_thread ", int " policy ", const struct sched_param *" param ");" .BI "int pthread_getschedparam(pthread_t " target_thread ", int *" policy ", struct sched_param *" param ");" .SH DESCRIPTION .B "pthread_setschedparam" sets the scheduling parameters for the thread .I "target_thread" as indicated by .I "policy" and .IR "param" . .I "policy" can be either .B "SCHED_OTHER" (regular, non-realtime scheduling), .B "SCHED_RR" (realtime, round-robin) or .B "SCHED_FIFO" (realtime, first-in first-out). .I "param" specifies the scheduling priority for the two realtime policies. See .BR "sched_setpolicy" (2) for more information on scheduling policies. The realtime scheduling policies .B "SCHED_RR" and .B "SCHED_FIFO" are available only to processes with superuser privileges. .B "pthread_getschedparam" retrieves the scheduling policy and scheduling parameters for the thread .I "target_thread" and store them in the locations pointed to by .I "policy" and .IR "param" , respectively. .SH "RETURN VALUE" .B "pthread_setschedparam" and .B "pthread_getschedparam" return 0 on success and a non-zero error code on error. .SH ERRORS On error, .B "pthread_setschedparam" returns the following error codes: .RS .TP .B "EINVAL" .I "policy" is not one of .BR "SCHED_OTHER" , .BR "SCHED_RR" , .B "SCHED_FIFO" .TP .B "EINVAL" the priority value specified by .I "param" is not valid for the specified policy .TP .B "EPERM" the calling process does not have superuser permissions .TP .B "ESRCH" the .I "target_thread" is invalid or has already terminated .TP .B "EFAULT" .I "param" points outside the process memory space .RE On error, .B "pthread_getschedparam" returns the following error codes: .RS .TP .B "ESRCH" the .I "target_thread" is invalid or has already terminated .TP .B "EFAULT" .I "policy" or .I "param" point outside the process memory space .RE .SH AUTHOR Xavier Leroy .SH "SEE ALSO" .BR "sched_setscheduler" (2), .BR "sched_getscheduler" (2), .BR "sched_getparam" (2), .BR "pthread_attr_setschedpolicy" (3), .BR "pthread_attr_setschedparam" (3).