EINVAL when SCHED_OTHER thread tries to hold PTHREAD_PRIO_PROTECT mutex

Carlos O'Donell carlos@codesourcery.com
Thu Mar 27 14:50:00 GMT 2008


Sripathi Kodi wrote:
> I have a program where a SCHED_OTHER thread tries to hold a 
> pthread_mutex_t initialized with the PTHREAD_PRIO_PROTECT protocol. 
> This fails with an EINVAL. Using strace/ltrace, I found that the 
> sched_setscheduler, internally called by pthread_mutex_lock returns 
> EINVAL, because it tries to set the priority of the thread to a value 
> not permissible for SCHED_OTHER.

This is probably because the kernel doesn't allow SCHED_OTHER processes 
to have any priority other than 0? Have you tried using SCHED_RR?

Cheers,
Carlos.
-- 
Carlos O'Donell
CodeSourcery
carlos@codesourcery.com
(650) 331-3385 x716



More information about the Libc-alpha mailing list