多线程编程指南

获取调度策略

请使用 pthread_attr_getschedpolicy(3C) 检索调度策略。

pthread_attr_getschedpolicy 语法

int	pthread_attr_getschedpolicy(pthread_attr_t *tattr, int *policy);
#include <pthread.h>



pthread_attr_t tattr;

int policy;

int ret;



/* get scheduling policy of thread */

ret = pthread_attr_getschedpolicy (&tattr, &policy); 

pthread_attr_getschedpolicy 返回值

pthread_attr_getschedpolicy() 成功完成后将返回零。其他任何返回值都表示出现了错误。如果出现以下情况,该函数将失败并返回对应的值。


EINVAL

描述:

参数 policyNULLtattr 无效。