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:
the status code of all the calls above are all 0's.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);
However, when I do pthread_create, it returns a positive 1 and when I do
If I remove pthread_attr_setinheritsched statement, the code runs to completion but just not changing the policy.Code:if (status == 1){ perror ("pthread_create error"); exit(1); } pthread_create error: Numerical result out of range
Any suggestion/comments are welcome. Thank you in advanced



LinkBack URL
About LinkBacks



