Returns the current schedpolicy and schedparam attributes of a thread.
Threads Library (libpthreads.a)
#include <pthread.h>
#include <sys/sched.h>
int pthread_getschedparam ( thread, schedpolicy, schedparam)
pthread_t thread;
int *schedpolicy;
struct sched_param *schedparam;
The pthread_getschedparam subroutine returns the current schedpolicy and schedparam attributes of the thread thread. The schedpolicy attribute specifies the scheduling policy of a thread. It may have one of the following values:
Item | Description |
---|---|
SCHED_FIFO | Denotes first-in first-out scheduling. |
SCHED_RR | Denotes round-robin scheduling. |
SCHED_OTHER | Denotes the default operating system scheduling policy. It is the default value. |
The schedparam attribute specifies the scheduling parameters of a thread created with this attributes object. The sched_priority field of the sched_param structure contains the priority of the thread. It is an integer value.
The implementation of this subroutine is dependent on the priority scheduling POSIX option. The priority scheduling POSIX option is implemented in the operating system.
Item | Description |
---|---|
thread | Specifies the target thread. |
schedpolicy | Points to where the schedpolicy attribute value will be stored. |
schedparam | Points to where the schedparam attribute value will be stored. |
Upon successful completion, the current value of the schedpolicy and schedparam attributes are returned via the schedpolicy and schedparam parameters, and 0 is returned. Otherwise, an error code is returned.
The pthread_getschedparam subroutine is unsuccessful if the following is true:
Item | Description |
---|---|
ESRCH | The thread thread does not exist. |