struct sched_param
{
int __sched_priority; //所要设定的线程优先级
};
例:创建优先级为10的线程
pthread_attr_t attr;
struct sched_param param;
pthread_attr_init(&attr);
pthread_attr_setschedpolicy(&attr, SCHED_RR);
param.sched_priority = 10;
pthread_attr_setschedparam(&attr, ¶m);
pthread_create(xxx , &attr , xxx , xxx);
pthread_attr_destroy(&attr);
|