2

I am trying to assign the max priority allowed for SCHED_RR policy on kernel 3.2.23-rt37.56.el6rt.x86_64. The code is as shown below. The max_prio_for_policy on line 7 and 8 is zero. What is wrong in the code?

    pthread_t thId = pthread_self();
    pthread_attr_t theAttr;
    int policy = SCHED_RR;
    int max_prio_for_policy = 0;

    pthread_attr_init(&theAttr);
    pthread_attr_getschedpolicy(&theAttr, &policy);
    max_prio_for_policy = sched_get_priority_max(policy);

    printf("setting thread priority to: %d\n", max_prio_for_policy);

UPDATE: I ran this code on both kernel 3.2.23-rt37.56.el6rt.x86_64 and 2.6.32-279.el6.x86_64, and found the result to be the same.

SOLVED: i was doing #include "linux/sched.h" as opposed to "sched.h"

4

0 回答 0