1 PTHREAD_GETSCHEDPARAM(3C) Standard C Library Functions 2 3 4 5 NAME 6 pthread_getschedparam, pthread_setschedparam - access dynamic thread 7 scheduling parameters 8 9 SYNOPSIS 10 cc -mt [ flag... ] file... -lpthread [ library... ] 11 #include <pthread.h> 12 13 int pthread_getschedparam(pthread_t thread, int *restrict policy, 14 struct sched_param *restrict param); 15 16 17 int pthread_setschedparam(pthread_t thread, int policy, 18 const struct sched_param *param); 19 20 21 DESCRIPTION 22 The pthread_getschedparam() and pthread_setschedparam() functions allow 23 the scheduling policy and scheduling parameters of individual threads 24 within a multithreaded process to be retrieved and set. Supported 25 policies are : 26 27 SCHED_OTHER 28 traditional time-sharing scheduling class 29 30 31 SCHED_FIFO 32 real-time class: run to completion 33 34 35 SCHED_RR 36 real-time class: round-robin 37 38 39 SCHED_IA 40 interactive time-sharing class 41 42 43 SCHED_FSS 44 fair-share scheduling class 45 46 47 SCHED_FX 48 fixed priority scheduling class 49 50 51 52 See pthreads(5). The affected scheduling parameter is the 53 sched_priority member of the sched_param structure. 54 55 56 The pthread_getschedparam() function retrieves the scheduling policy 57 and scheduling parameters for the thread whose thread ID is given by 58 thread and stores those values in policy and param, respectively. The 59 priority value returned from pthread_getschedparam() is the value 60 specified by the most recent pthread_setschedparam() or 61 pthread_create() call affecting the target thread, and does not reflect 62 any temporary adjustments to its priority as a result of any priority 63 inheritance or ceiling functions. The pthread_setschedparam() function 64 sets the scheduling policy and associated scheduling parameters for the 65 thread whose thread ID is given by thread to the policy and associated 66 parameters provided in policy and param, respectively. 67 68 69 If the pthread_setschedparam() function fails, no scheduling parameters 70 will be changed for the target thread. 71 72 RETURN VALUES 73 If successful, the pthread_getschedparam() and pthread_setschedparam() 74 functions return 0. Otherwise, an error number is returned to indicate 75 the error. 76 77 ERRORS 78 The pthread_getschedparam() and pthread_setschedparam() functions will 79 fail if: 80 81 ESRCH 82 The value specified by thread does not refer to an existing 83 thread. 84 85 86 87 The pthread_setschedparam() function will fail if: 88 89 EINVAL 90 The value specified by policy or one of the scheduling 91 parameters associated with the scheduling policy policy is 92 invalid. 93 94 95 EPERM 96 The caller does not have the appropriate permission to set 97 either the scheduling parameters or the scheduling policy of 98 the specified thread. 99 100 101 ATTRIBUTES 102 See attributes(5) for descriptions of the following attributes: 103 104 105 106 107 +--------------------+-------------------+ 108 | ATTRIBUTE TYPE | ATTRIBUTE VALUE | 109 +--------------------+-------------------+ 110 |Interface Stability | Committed | 111 +--------------------+-------------------+ 112 |MT-Level | MT-Safe | 113 +--------------------+-------------------+ 114 |Standard | See standards(5). | 115 +--------------------+-------------------+ 116 117 SEE ALSO 118 pthread_attr_init(3C), sched_getparam(3C), sched_get_priority_max(3C), 119 sched_get_priority_max(3C), sched_get_priority_min(3C), 120 sched_setparam(3C), sched_getscheduler(3C), sched_setscheduler(3C), 121 attributes(5), pthreads(5), standards(5) 122 123 124 125 April 1, 2008 PTHREAD_GETSCHEDPARAM(3C)