pthread_setschedparam.txt
来自「Pthread lib库完整说明文档」· 文本 代码 · 共 110 行
TXT
110 行
--------------------------------------------------------------------------------AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 1--------------------------------------------------------------------------------pthread_setschedparam SubroutinePurposeReturns the current schedpolicy and schedparam attributes of a thread.LibraryThreads Library (libpthreads.a)Syntax#include <pthread.h>#include <sys/sched.h>int pthread_setschedparam (thread, schedpolicy, schedparam)pthread_t thread;int schedpolicy;const struct sched_param *schedparam;DescriptionThe pthread_setschedparam subroutine dynamically sets the schedpolicy andschedparam attributes of the thread thread. The schedpolicy attibute specifiesthe scheduling policy of the thread. The schedparam attribute specifies thescheduling parameters of a thread created with this attributes object. Thesched_priority field of the sched_param structure contains the priority of thethread. It is an integer value.If the target thread has system contention scope, the process must have rootauthority 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.Parametersthread Specifies the target thread.schedpolicy Points to the schedpolicy attribute to set. It must have one of thefollowing values:SCHED_FIFO Denotes first-in first-out scheduling.SCHED_RR Denotes round-robin scheduling.SCHED_OTHER Denotes the default AIX scheduling policy. It is the default value. Note: It is not permitted to change the priority of a thread when setting its scheduling policy to SCHED_OTHER. In this case, the priority is managed directly by the kernel, and the only legal value that can be passed to pthread_setschedparam is DEFAULT_PRIO, which is defined in pthread.h as 1.schedparam Points to where the scheduling parameters to set are stored. Thesched_priority field must be in the range from 1 to 127, where 1 is the leastfavored priority, and 127 the most favored.Return ValuesUpon successful completion, 0 is returned. Otherwise, an error code is returned.Error CodesThe 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 oris already engaged in a mutex protocol.ESRCH The thread thread does not exist.Implementation SpecificsThis subroutine is part of the Base Operating System (BOS) Runtime. Theimplementation of this subroutine is dependent on the priority scheduling POSIXoption. The priority scheduling POSIX option is implemented in AIX.Related InformationThe pthread_getschedparam subroutine, pthread_attr_setschedpolicy subroutine,pthread_attr_setschedparam subroutine.Threads Scheduling in AIX Version 4.3 General Programming Concepts: Writing andDebugging Programs.Threads Library Options in AIX Version 4.3 General Programming Concepts: Writingand Debugging Programs.Threads Library Quick Reference in AIX Version 4.3 General Programming Concepts:Writing and Debugging Programs.--------------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?