Hi all,
I'm not sure if it is the right place to ask questions about pthread but here's my problem.
I'm trying to set the policy/priority for the threads. I read somewhere that I need to be superuser to change those info. Is that correct ? I tried the following:
Code:
status = pthread_attr_init (&thread_attr);
fprintf (stderr, "pthread_attr_init returns %d\n", status);
status = pthread_attr_setschedpolicy(&thread_attr, SCHED_FIFO);
fprintf (stderr, "pthread_attr_setschedpolicy returns %d\n", status);
status = pthread_attr_setinheritsched(&thread_attr, PTHREAD_EXPLICIT_SCHED);
the status code of all the calls above are all 0's.
However, when I do pthread_create, it returns a positive 1 and when I do
Code:
if (status == 1){
perror ("pthread_create error");
exit(1);
}
pthread_create error: Numerical result out of range
If I remove pthread_attr_setinheritsched statement, the code runs to completion but just not changing the policy.
Any suggestion/comments are welcome. Thank you in advanced