Returns the current schedpolicy and schedparam attributes of a thread.
Threads Library (libpthreads.a)
#include <pthread.h> #include <sys/sched.h> int pthread_setschedparam (thread, schedpolicy, schedparam) pthread_t thread; int schedpolicy; const struct sched_param *schedparam;
The pthread_setschedparam subroutine dynamically sets the schedpolicy and schedparam attributes of the thread thread. The schedpolicy attibute specifies the scheduling policy of the thread. 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.
If the target thread has system contention scope, the process must have root authority to set the scheduling policy to either SCHED_FIFO or SCHED_RR.
Note: The pthread.h header file must be the first included file of each source file using the threads library. Otherwise, the -D_THREAD_SAFE compilation flag should be used, or the cc_r compiler used. In this case, the flag is automatically set.
Upon successful completion, 0 is returned. Otherwise, an error code is returned.
The pthread_setschedparam subroutine is unsuccessful if the following is true:
EINVAL | The thread or schedparam parameters are not valid. |
ENOSYS | The priority scheduling POSIX option is not implemented. |
ENOTSUP | The value of the schedpolicy or schedparam attributes are not supported. |
EPERM | The target thread has insufficient permission to perform the operation or is already engaged in a mutex protocol. |
ESRCH | The thread thread does not exist. |
This subroutine is part of the Base Operating System (BOS) Runtime. The implementation of this subroutine is dependent on the priority scheduling POSIX option. The priority scheduling POSIX option is implemented in AIX.
The pthread_getschedparam subroutine, pthread_attr_setschedpolicy subroutine, pthread_attr_setschedparam subroutine.
Threads Scheduling in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.
Threads Library Options in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.
Threads Library Quick Reference in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.