pthreads with real time priority

后端 未结 1 1979
南方客
南方客 2021-02-09 13:23

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 *         


        
相关标签:
1条回答
  • 2021-02-09 13:56

    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.

    0 讨论(0)
提交回复
热议问题