37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
/*
* This is done here to make sure this is done as early as possible in the main
* thread.
*/
OF_CONSTRUCTOR()
{
pthread_attr_t pattr;
int policy;
struct sched_param param;
OF_ENSURE(pthread_attr_init(&pattr) == 0);
OF_ENSURE(pthread_attr_getschedpolicy(&pattr, &policy) == 0);
OF_ENSURE((minPrio = sched_get_priority_min(policy)) != -1);
OF_ENSURE((maxPrio = sched_get_priority_max(policy)) != -1);
OF_ENSURE(pthread_attr_getschedparam(&pattr, ¶m) == 0);
normalPrio = param.sched_priority;
pthread_attr_destroy(&pattr);
}
|
>
>
>
>
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/*
* This is done here to make sure this is done as early as possible in the main
* thread.
*/
OF_CONSTRUCTOR()
{
pthread_attr_t pattr;
#ifdef HAVE_PTHREAD_ATTR_GETSCHEDPOLICY
int policy;
#endif
struct sched_param param;
OF_ENSURE(pthread_attr_init(&pattr) == 0);
#ifdef HAVE_PTHREAD_ATTR_GETSCHEDPOLICY
OF_ENSURE(pthread_attr_getschedpolicy(&pattr, &policy) == 0);
OF_ENSURE((minPrio = sched_get_priority_min(policy)) != -1);
OF_ENSURE((maxPrio = sched_get_priority_max(policy)) != -1);
#endif
OF_ENSURE(pthread_attr_getschedparam(&pattr, ¶m) == 0);
normalPrio = param.sched_priority;
pthread_attr_destroy(&pattr);
}
|