Finally, if you do specify PTHREAD_EXPLICIT_SCHED for pthread_attr_setinheritsched(), then you'll need a way to specify both the scheduling policy and the priority of the thread you're about to create.
This is done with the two functions:
int pthread_attr_setschedparam (pthread_attr_t *attr, const struct sched_param *param); int pthread_attr_setschedpolicy (pthread_attr_t *attr, int policy);
The policy is simple; it's one of SCHED_FIFO, SCHED_RR, or SCHED_OTHER.
The param is a structure that contains one member of relevance here: sched_priority. Set this value via direct assignment to the desired priority.
Been there, done that, got the T-shirt. :-)
Enough people have been bitten by this that QNX Software Systems has made priority zero reserved for only the idle thread. You simply cannot run a thread at priority zero.