#include <pthread.h>
|
|
int
pthread_setschedparam (pthread_t thread, int policy, const struct sched_param *param); |
|
int
pthread_getschedparam (pthread_t thread, int *policy, struct sched_param *param); |
struct sched_param sparam;
int policy, priority, policy_1;
int rc;
policy = SCHED_RR;
priority = 50;
sparam.sched_priority = priority;
rc = pthread_setschedparam(pthread_self(), policy, &sparam);
if (rc != 0)
{
printf("Error at pthread_setschedparam: rc=%d\n", rc);
return -1;
}
int e ;
struct sched_param param;
pthread_t thread; // Thread which will be assigned the scheduling priority and the policy.
pthread_t thread = pthread_self();
param.sched_priority = 100;
e = pthread_setschedparam(thread,SCHED_RR, & param);
if(e != 0)
{
printf("setting scheduling policy and priority failed."));
return -1;
}
int e ;
struct sched_param param;
pthread_t thread; // Thread which will be assigned the scheduling priority and the policy.
int policy;
pthread_t thread = pthread_self();
param.sched_priority = 100;
e = pthread_setschedparam(thread,SCHED_RR, & param);
if(e != 0)
{
printf("setting scheduling policy and priority failed."));
return -1;
}
e = pthread_getschedparam(thread,&policy,& param);
if (e != 0)
{
printf("getting scheduling policy and priority failed."));
return -1;
}
| [EINVAL] | |
| Invalid value for policy or param | |
| [ENOTSUP] | |
| Invalid value for scheduling parameters. | |
| [ESRCH] | |
| Non-existent thread thread. | |
The pthread_getschedparam function will fail if:
| [ESRCH] | |
| Non-existent thread thread. | |
|
© 2005-2007 Nokia |