pthread_setschedprio()函数详解!!!

 

pthread_setschedprio()

Set a thread's priority 用于设置现成的优先级

包含在头文件

#include <pthread.h>
用法:
int pthread_setschedprio( pthread_t thread, int prio );
thread是你想要修改的线程的线程id;
prio 是你将要修改成的优先级

如果线程正在运行或运行,就绪队列中的位置对其的影响取决于修改的方向:

如果你提高优先级,线程成为优先级的就绪队列的尾部。

如果你不改变优先级,线程不会改变位置在就绪队列中。

如果你降低优先级,线程成为这个优先级就绪队列的头。

 

Returns:

EOK    Success. 
EINVAL The priority isn't valid for the scheduling policy of the specified thread.
ENOTSUP The specified priority isn't supported.
EPERM The calling thread doesn't have sufficient privileges to modify the specified thread's priority.
ESRCH Invalid thread ID thread

 

posted @ 2015-05-13 15:46  小子耳东  阅读(1978)  评论(0编辑  收藏  举报