I need to manage a pool of threads having different priorities, so I wrote the following thread startup procedure:
static
int startup(thrd_t *thrd, thrd_sync_t *
I think you also have to use pthread_attr_setinheritsched
to ensure that your changes to the priority setting are taken into account. From the man page:
PTHREAD_INHERIT_SCHED Specifies that the scheduling policy and associated attributes are to be inherited from the creating thread, and the scheduling attributes in this attr argument are to be ignored.
PTHREAD_EXPLICIT_SCHED Specifies that the scheduling policy and associated attributes are to be set to the corresponding values from this attribute object.
And a little bit further in the man page, you have :
The default setting of the inherit-scheduler attribute in a newly initialized thread attributes object is PTHREAD_INHERIT_SCHED.